Results 1 to 12 of 12

Thread: dll + application

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2006
    Posts
    25
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Re: dll + application

    Hello,

    I compiled my library as staticlib and the application don't have problems runs all rigth with Q_OBJECT defined, but what that's mean ? with static lib runs ok, this mean that all is exported all rigth. This problem tells me that precomipiled binaries 4.2.2 for windows are working in static ? I'm confused in some concepts, why not in dynamic ?

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: dll + application

    Honestly your project file does not help much, especially because it is only a subdir wrapper. What would be interesting is a minimum compilable example reproducing the bug you're facing.

    I compiled my library as staticlib and the application don't have problems
    Didn't you previously said that YOUR library had been compiled as dll (shared library)??? The notion of exporting symbols is something that is very specific because AFAIk it is required only under Window$ with SHARED libraries... Thus, a static version compiling/linking/running fine does not imply that a shared one will do the same under Window$... Exporting/importing under Qt is done through two macros Q_DECL_EXPORT and Q_DECL_IMPORT which are often wrapped by another macro for more ease of use :

    Qt Code:
    1. #ifdef _BUILD_MY_LIB_
    2. #if defined(QT_DLL) || defined(QT_SHARED)
    3. #define MYLIB_EXPORT Q_DECL_EXPORT
    4. #endif
    5. #else
    6. #define MYLIB_EXPORT Q_DECL_IMPORT
    7. #endif
    To copy to clipboard, switch view to plain text mode 

    Then definitions of classes/functions to export should be prefixed with th MYLIB_EXPORT macro (or whatever you called it of course) as follows :
    Qt Code:
    1. class MYLIB_EXPORT SomeClass {};
    2.  
    3. MYLIB_EXPORT void someFunction();
    To copy to clipboard, switch view to plain text mode 

    Hope this helps.
    Current Qt projects : QCodeEdit, RotiDeCode

  3. The following user says thank you to fullmetalcoder for this useful post:

    fpujol (16th April 2007)

Similar Threads

  1. Replies: 3
    Last Post: 6th March 2007, 19:24
  2. Replies: 3
    Last Post: 8th December 2006, 19:51
  3. Application default font
    By larry104 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2006, 02:24
  4. Gnome makes application crash
    By regix in forum Qt Programming
    Replies: 35
    Last Post: 18th August 2006, 20:44
  5. Replies: 3
    Last Post: 31st March 2006, 19:38

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.