Results 1 to 4 of 4

Thread: Issues with development of DLL library using Qt/Qt Creator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Issues with development of DLL library using Qt/Qt Creator

    You don't need two headers. If you have only one public header you can also add the export/import macros to that header.
    It is just customary to split the macro definition into a separate header, because a library often has more than one public header and then you can just include the macro definition one in each of them.

    The import/export macro definition is required to get symbol visibility right. Depending on platform and compiler settings, symbols such as classes or functions can be "hidden" by the compiler, i.e. only visible within the library itself but not to the program linking the library.
    Naturally you want the symbols of your public API to be visible, hence the need to mark them for export.

    Since you mentioned static linking a couple of times: this has nothing to do with DLLs, a concept which has "Dynamic Linking" even as part of its name!

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    Momergil (13th March 2014)

  3. #2
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    165
    Thanked 2 Times in 2 Posts

    Default Re: Issues with development of DLL library using Qt/Qt Creator

    Thanks for the news, anda_skoa! I'll gladly move the things from _global to the unique other header when possible now

    Quote Originally Posted by anda_skoa View Post
    Since you mentioned static linking a couple of times: this has nothing to do with DLLs, a concept which has "Dynamic Linking" even as part of its name!
    Sorry if I used a misleading terminology... By "static" I just mean "Not at runtime"
    May the Lord be with you. Always.

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Issues with development of DLL library using Qt/Qt Creator

    Quote Originally Posted by Momergil View Post
    Thanks for the news, anda_skoa! I'll gladly move the things from _global to the unique other header when possible now
    That has always been possible.

    Quote Originally Posted by Momergil View Post
    Sorry if I used a misleading terminology... By "static" I just mean "Not at runtime"
    Yes, static linking means that the library doesn't have to be loaded at runtime.
    DLLs always have to be loaded at runtime, that's the D in DLL.

    A static library is not a DLL and also doesn't need export macros on its symbols.

    Cheers,
    _

Similar Threads

  1. QT creator with Maemo issues in building
    By rg4gp in forum Newbie
    Replies: 0
    Last Post: 11th September 2012, 20:19
  2. Replies: 2
    Last Post: 19th February 2011, 11:26
  3. Replies: 0
    Last Post: 17th March 2010, 22:52
  4. QT Creator Linking issues
    By sgrant327 in forum Qt Programming
    Replies: 14
    Last Post: 16th December 2009, 15:42
  5. Replies: 1
    Last Post: 13th August 2009, 16:32

Tags for this Thread

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.