Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Modifying a dumpcpp created interface to provide a better match to #import from the same typelib?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved