Modifying a dumpcpp created interface to provide a better match to #import from the same typelib?



  • I'm trying to update some Qt3 & MSVC code to Qt4 & mingw. Everything is working except handling of a COM object...

    I've used dumpcpp to build an axcontainer interface which is a great advance & at least gets me started, however the interface dumpcpp provides varies in some crucial respects from the one that MSVC's #import creates from the same typelib.

    Here's an example of the crucial difference:

    #import implements:

    @inline SDO::IWorkspacesPtr SDO::ISDOEngine::GetWorkspaces ( ) {
    struct IWorkspaces * _result;
    _com_dispatch_propget(this, 0x1, VT_DISPATCH, (void*)&_result);
    return IWorkspacesPtr(_result, false);
    }@

    but the closest equivalent that dumpcpp implements is:

    @inline SDO::Workspaces* ISDOEngine::Workspaces() const
    {
    SDO::Workspaces* qax_pointer = 0;
    qRegisterMetaType("Workspaces*", &qax_pointer);
    qRegisterMetaType("Workspaces", qax_pointer);
    QVariant qax_result = property("Workspaces");
    if (!qax_result.constData()) return 0;
    Q_ASSERT(qax_result.isValid());
    return (SDO::Workspaces*)qax_result.constData();
    }@

    The #import variant returns an SDO::IWorkspaces* (& works), but dumpcpp tries to return a SDO::Workspaces* (& fails).

    So far as I can see the dumpcpp function is failing because its implementation tries to create an SDO::Workspaces object, but that's not possible because the uuid of the SDO::Workspaces isn't registered.

    The COM object is deliberately designed to only expose/register one uuid, that of the SDOEngine. Everything else is intended to be accessed via pointers to "I" objects returned by functions such as the above.

    So far I've not been able to work out a way around this.

    Can someone with more more experience with QAx suggest a way to code an equivalent of the #import variant?



  • Working on this myself, I've found that a direct equivalent for the working (in MSVC) code, i.e.

    @SDO::IWorkspaces* pIWorkspaces;
    _com_dispatch_propget( (IDispatch*)pEngine, 0x1, VT_DISPATCH, (void*)&pIWorkspaces );@

    compiles fine (_com_dispatch_propget is declared in mingw's comdef.h), but fails at the link stage with "undefined reference". I haven't been able to find what library I'd need to link to provide _com_dispatch_propget.

    Can anyone say what library I need? Or offer any alternative suggestions?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.