Results 1 to 3 of 3

Thread: How to link statically lib files made different for INTEL and AMD platforms

  1. #1
    Join Date
    May 2011
    Location
    Transylvania
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Exclamation How to link statically lib files made different for INTEL and AMD platforms

    I am in a strange situations: I linked some library dynamically but I got a lot of memory leakage. To investigate the problem, now I want to link the library statically at "compile time" but I have two different library for INTEL and AMD platforms. These libs does the same things (in fact they are drivers), communicate with the same external device by USB (FTDI made FT4232, but this does not matter now). How to manage this AMD or INTEL platform situation? How can I make a difference between them at runtime? I am confused. Are some docs available about these platform-linking situations?
    Thanks for the answers! Attila

  2. #2
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to link statically lib files made different for INTEL and AMD platforms

    Do the AMD and Intel driver library have the same API (same function names, #defines, etc.)?
    If yes you cannot link both statically into your application (at least not without doing some weird things).

    If no you need to determine the OEM of the CPU at runtime and make the corresponding library calls. Doing this is platform specific (Win, Linux, etc.). I don't know how to do it in Windows but in Linux there should be /dev/cpu if I remember correctly.

    If the AMD and Intel library have different APIs I would suggest to provide a common Interface for them.
    The Adapter pattern (according to the "Gang of Four") would be my way to achieve this.

  3. #3
    Join Date
    May 2011
    Location
    Transylvania
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to link statically lib files made different for INTEL and AMD platforms

    All functions have the same name, the same calling parameters, same return types, ..., same "c" type funtion. This was the reason why I linked them dynamically with QLibrary and I think that the static linking is almost a useless thing if we talk about freqvently updated things like drivers. But to detect my memory problem I had no other idea than to try a static linking too... Do you know a good valgrind like tool for windows? Very thanks for the answer!

Similar Threads

  1. Replies: 2
    Last Post: 2nd August 2011, 15:14
  2. How to link the DLL statically
    By Sergei Smirnov in forum Newbie
    Replies: 0
    Last Post: 21st June 2010, 17:53
  3. statically link Qt libraries (not build static library)
    By mcarter in forum Qt Programming
    Replies: 3
    Last Post: 1st February 2010, 20:42
  4. Is it possible to link the qt library files into exe?
    By hashb in forum Installation and Deployment
    Replies: 2
    Last Post: 7th January 2010, 14:41
  5. Link all Qt libs statically.
    By psih128 in forum Installation and Deployment
    Replies: 12
    Last Post: 29th December 2008, 20:48

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.