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. Load the object from dll
Forum Updated to NodeBB v4.3 + New Features

Load the object from dll

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.7k 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.
  • D Offline
    D Offline
    DmT021
    wrote on last edited by
    #1

    Hello all
    There is a dll which I need to use.
    I have an interface looks like this:
    @[ object, uuid("00000000-0000-0000-0000-000000000000") ]
    __interface Interface
    {
    public:
    virtual bool Init(void) = 0;
    virtual bool Destroy(void) = 0;
    virtual bool Test(void) = 0;
    };
    @
    There is a function in the dll, which gives a pointer to object of class with implements of that interface.

    I can load the dll using QLibrary, and I can resolve this function, and call it. But how to declare the interface in the right way using -QT- Qt? And how to call the methods of given object?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DmT021
      wrote on last edited by
      #2

      solve:
      @static const GUID IID_object = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 0x0, 0x00 } };
      class Interface : IUnknown
      {
      public:
      virtual bool Init(void) = 0;
      virtual bool Destroy(void) = 0;
      virtual bool Test(void) = 0;
      };@

      PS: guid also could be resolved via QUuid

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        Looks like you are using COM, right?
        Why don't you use COM methods then? like CoCreateInstance etc?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        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