Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3673

Dumpcpp output compilation errors

    XMLWordPrintable

Details

    Description

      Running 'dumpcpp -n sldworks sldworks.tlb' (SolidWorks 2008 API) produces code with at least two types of compilation errors:

      1) pointers to references such as:

          return *(double&*)qax_result.constData(); 
       

      2) cases where compilation of:

          qRegisterMetaType("ISomeInterface", qax_pointer); 
       

      fail because the object pointed to by qax_pointer derives from QAxObject and the compiler tries to create a copy constructor for QAxObject which it cannot do.

      -----------------------------------------
      1) This seems to be caused by an unsupported property defenition in the type library.

           property get ==>  HRESULT XXXXXPropertyValues([out, retval] double* Retval);
           property put ==> HRESULT XXXXXlPropertyValues([in] double* Retval);
      
      • Note that both parameters for put & get of same type. ActiveQt dosen't support this type of constructs.

      2) ActiveQt supports only dispatch interfaces (of type kind TKIND_DISPATCH). Try this patch for dumpcpp, it will generate a dummy function instead.

      diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp
      index 05f1f19..45c7ee8 100644
      --- a/tools/activeqt/dumpcpp/main.cpp
      +++ b/tools/activeqt/dumpcpp/main.cpp
      @@ -110,6 +110,7 @@ extern bool qax_dispatchEqualsIDispatch;
       
       QByteArray nameSpace;
       QMap<QByteArray, QByteArray> namespaceForType;
      +QStringList vtableOnlyInterfaces;
       
       void writeEnums(QTextStream &out, const QMetaObject *mo)
       {
      @@ -333,33 +334,38 @@ void generateClassDecl(QTextStream &out, const QString &controlID, const QMetaOb
       
               if (!(category & NoInlines)) {
                   out << endl << indent << "{" << endl;
      -            if (qax_qualified_usertypes.contains(simplePropType)) {
      -                out << indent << "    " << propertyType << " qax_pointer = 0;" << endl;
      -                out << indent << "    qRegisterMetaType(\"" << property.typeName() << "\", &qax_pointer);" << endl;
      -                if (foreignNamespace)
      -                    out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl;
      -                out << indent << "    qRegisterMetaType(\"" << simplePropType << "\", qax_pointer);" << endl;
      -                if (foreignNamespace)
      -                    out << "#endif" << endl;
      -            }
      -            out << indent << "    QVariant qax_result = property(\"" << propertyName << "\");" << endl;
      -            if (propertyType.length() && propertyType.at(propertyType.length()-1) == '*')
      -                out << indent << "    if (!qax_result.constData()) return 0;" << endl;
      -            out << indent << "    Q_ASSERT(qax_result.isValid());" << endl;
      -            if (qax_qualified_usertypes.contains(simplePropType)) {
      -                simplePropType = propertyType;
      -                simplePropType.replace('*', "");
      -                if (foreignNamespace)
      -                    out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl;
      -                out << indent << "    return *(" << propertyType << "*)qax_result.constData();" << endl;
      -                if (foreignNamespace) {
      -                    out << "#else" << endl;
      -                    out << indent << "    return 0; // foreign namespace not included" << endl;
      -                    out << "#endif" << endl;
      +            if (qax_qualified_usertypes.contains(simplePropType) && vtableOnlyInterfaces.contains(simplePropType)) {
      +                out << indent << "    // vtable-only interface is not supported by ActiveQt" << endl;
      +                out << indent << "    return 0;" << endl;
      +            } else {
      +                if (qax_qualified_usertypes.contains(simplePropType)) {
      +                    out << indent << "    " << propertyType << " qax_pointer = 0;" << endl;
      +                    out << indent << "    qRegisterMetaType(\"" << property.typeName() << "\", &qax_pointer);" << endl;
      +                    if (foreignNamespace)
      +                        out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl;
      +                    out << indent << "    qRegisterMetaType(\"" << simplePropType << "\", qax_pointer);" << endl;
      +                    if (foreignNamespace)
      +                        out << "#endif" << endl;
                       }
      +                out << indent << "    QVariant qax_result = property(\"" << propertyName << "\");" << endl;
      +                if (propertyType.length() && propertyType.at(propertyType.length()-1) == '*')
      +                    out << indent << "    if (!qax_result.constData()) return 0;" << endl;
      +                out << indent << "    Q_ASSERT(qax_result.isValid());" << endl;
      +                if (qax_qualified_usertypes.contains(simplePropType)) {
      +                    simplePropType = propertyType;
      +                    simplePropType.replace('*', "");
      +                    if (foreignNamespace)
      +                        out << "#ifdef QAX_DUMPCPP_" << propertyType.left(propertyType.indexOf("::")).toUpper() << "_H" << endl;
      +                    out << indent << "    return *(" << propertyType << "*)qax_result.constData();" << endl;
      +                    if (foreignNamespace) {
      +                        out << "#else" << endl;
      +                        out << indent << "    return 0; // foreign namespace not included" << endl;
      +                        out << "#endif" << endl;
      +                    }
       
      -            } else {
      -                out << indent << "    return *(" << propertyType << "*)qax_result.constData();" << endl;
      +                } else {
      +                    out << indent << "    return *(" << propertyType << "*)qax_result.constData();" << endl;
      +                }
                   }
                   out << indent << "}" << endl;
               } else {
      @@ -1095,6 +1101,9 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O
                               case TKIND_ENUM:
                                   className = "enum " + className;
                                   break;
      +                        case TKIND_INTERFACE:
      +                            vtableOnlyInterfaces.append(className);
      +                            break;
                               default:
                                   break;
                               }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pullatti Prasanth Ullattil
            xcm Martin Petersson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes