Results 1 to 3 of 3

Thread: Dynamic include dll's

  1. #1
    Join Date
    Sep 2011
    Posts
    26
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Dynamic include dll's

    Hello,

    i want to include dynamicly dll's. Is there a way without link header files in the main project?

  2. #2
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic include dll's

    I'm not sure that your question makes sense. Dlls are dynamic by definition. If you mean you only want to link a dll under certain conditions you could use compile time flags such as:

    Qt Code:
    1. #define YES_I_WANT_DLLS //comment this line out if you don't want them
    2.  
    3. #if defined YES_I_WANT_DLLS
    4. #include someLibrary
    5. #endif
    To copy to clipboard, switch view to plain text mode 

    and then your program will only check the dlls if that line is uncommented.



    If it's trouble including DLLs you need to:
    -include the library using your IDE or standard syntax
    -add the DLL's location to your "PATH" variable (or move the dlls to a location already in your path variable OR your current directory OR the directory of your .exe)

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,329
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Dynamic include dll's

    If you mean you only want to link a dll under certain conditions you could use compile time flags
    I don't think this is the OP's problem. I think he wants to load a DLL at run-time, but doesn't have the header files that define the classes and methods inside them so he can't compile that into the source code that uses the DLL.

    I don't know how you can do that unless you have some knowledge of what the DLL contains and can tell your program at compile time how to use it, at least to the level of knowing function names and signature.

    The QLibrary class has support for dynamic loading of DLLs; you can use the QLibrary::resolve() method at run-time to retrieve a pointer to a method with a known name contained in the library. There are specific requirements for how symbols must be exported from the library when it is compiled.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 29th March 2012, 19:56
  2. MOC'ing with #include's
    By mule in forum Qt Tools
    Replies: 6
    Last Post: 7th January 2012, 22:48
  3. Replies: 1
    Last Post: 20th January 2011, 17:17
  4. mfc in QT include
    By trusch in forum Qt Programming
    Replies: 3
    Last Post: 16th July 2009, 10:01
  5. include
    By mickey in forum Newbie
    Replies: 6
    Last Post: 4th April 2006, 23:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.