Results 1 to 9 of 9

Thread: using static windows lib

  1. #1
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question using static windows lib

    My platform: Qt SDK 2010.01 with MingW and Qt Creator

    I'm using a driver from FTDI for a project. I can successfully create an import library (using the reimp and dlltool as part of mingw-utils) from the vendor supplied DLL and lib file. App runs fine.

    The vendor also supplies a static library (.lib extension) most likely built with MS VS, but I'm not sure how to convert it so it can be linked with my app. If I run reimp on it, it produces a bunch of .OBJ files and two .def and two .a libs.

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using static windows lib

    I am able to successfully link external static libs (for example qextserialport) because I can just build the .a from source.
    Just wanted to know if it can be done without rebuilding from source given that the static lib is actually from a different compiler.

  3. #3
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using static windows lib

    No. A static lib is nothing more than object code from multiple modules all melded together, so there's a very explicit dependency between compiler and linker there. Staying within a given tool chain is fine (e.g. cl/ml + link of varying versions) but all bets are off once you cross that boundary.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: using static windows lib

    Maybe you could ask the vendor to build the library with MinGW for you or to provide the source code so that you can do it yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using static windows lib

    @Timoteo - I figured it would be too compiler dependent, but thanks anyway for the clarification

    @wysota - I doubt they would give me the sources, but I'll kindly ask them to rebuild on MingW.

  6. #6
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using static windows lib

    Is there a reason why you can't use the DLL they provide ?

    Regards,
    Marc

  7. #7
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using static windows lib

    Quote Originally Posted by marcvanriet View Post
    Is there a reason why you can't use the DLL they provide ?

    Regards,
    Marc
    I can use their DLL just fine as I have indicated. With static linking, I would have more control about using a specific and tested version in my app whereas now I need to make sure the other DLL is installed by the third party installer and that it is the correct version.

  8. #8
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using static windows lib

    OK

    It's just that I have the experience with their devices that it is always best to install the latest version of their drivers from the website.

    You have a point in having a 'stable' version since there's always a risk that the customer buys something like a serial cable with their chip in it, and they (or an installation CD that came with it) install an outdated version. But if your applicaton uses a FTDIchip cable that is bought off-the-shelf and integrated in your equipment, there's also the risk that some (newer) cable has a different chip revision or even a different chip built-in. Depends on your application of course.

    The linux versions of the D2XX drivers are not open source by the way, so I guess you won't get the code for the windows drivers either.

    Best regards,
    Marc

  9. #9
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using static windows lib

    I agree that you can rarely go wrong with the latest driver, but consider this:

    I provide a certain version of the driver with my app (or at least point the user to the driver on the FTDI website), but what do you do if the user doesn't install it and they just happen to have an old version of the driver on their machine... I've actually run into a situation like that. I was on site and busting my head against the wall until I realized that the driver was way older than what my app was tested with. My application did work, but was running into a driver bug that was fixed after the old driver but before my expected driver.

    I'm now planning to check for the version of the DLL so I don't run into this problem again.

Similar Threads

  1. Compiling static for Windows with OpenSSL
    By manekineko in forum Qt Programming
    Replies: 19
    Last Post: 23rd March 2012, 22:13
  2. Linking to a static library on Windows
    By rexi in forum Qt Programming
    Replies: 9
    Last Post: 27th July 2009, 19:54
  3. Deployment of Static Qt on Windows?
    By merry in forum Installation and Deployment
    Replies: 12
    Last Post: 21st July 2008, 10:09
  4. Qt 4.3 static linking on Windows
    By john_crichton in forum Installation and Deployment
    Replies: 2
    Last Post: 13th May 2008, 06:57
  5. Windows XP Qt 4.3.2 Static build
    By maxpower in forum Installation and Deployment
    Replies: 9
    Last Post: 2nd November 2007, 04:49

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.