Results 1 to 2 of 2

Thread: Help linking and using libs in simple project

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2014
    Location
    Sydney, Australia
    Posts
    16
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Help linking and using libs in simple project

    A '.a' file is an archive file. As I understand it, it tells the linker where to find your functions inside the dll.
    Your "SString-4.dll" should have come with a "SString-4.a" if it was for development use. If you don't have the .a file it's not the end of the world.

    -Download Dependency Walker.
    -Open your "SString-4.dll" with Dependency Walker.
    -On the middle-right side should be a list of all the functions contained in the dll.
    -Right click one of these functions and choose "Select All".
    -Right click again and choose "Copy function names".
    -Paste into Notepad and save as "SString-4.def" in the same directory as your dll.
    -The top line in the .def file should be "LIBRARY SString-4.dll". The next line should be "EXPORTS". Your list of functions will be below this.
    -After each function leave a space, then a "@" followed by the ordinal number of the function. You can get the ordinals by reading them off the list on Dependency Walker.
    Your .def file should now look something like this example here:

    Qt Code:
    1. LIBRARY K8055D.dll
    2. EXPORTS
    3. SetCounterDebounceTime @1
    4. ResetCounter @2
    5. ReadCounter @3
    6. ReadAllDigital @4
    7. ReadDigitalChannel @5
    8. SetAllDigital @6
    9. SetDigitalChannel @7
    10. ClearAllDigital @8
    11. ClearDigitalChannel @9
    12. WriteAllDigital @10
    13. SetAllAnalog @11
    14. SetAnalogChannel @12
    15. ClearAllAnalog @13
    16. ClearAnalogChannel @14
    17. OutputAllAnalog @15
    18. OutputAnalogChannel @16
    19. ReadAllAnalog @17
    20. ReadAnalogChannel @18
    21. CloseDevice @19
    22. OpenDevice @20
    To copy to clipboard, switch view to plain text mode 
    -Now open windows command line and type: PATH=%PATH%;C:\Qt\2010.05\mingw\bin (or whatever the path to 'dlltool' is on your build)
    -CD to the directory where your dll and .def files are located.
    -Then type: dlltool -v --dllname SString-4.dll --def SString-4.def --output-lib SString-4.a

    If all was successful you should see a list of stuff from dlltool and your .a file will be created.

    I've had to this before with dlls that didn't come with the required files so I understand your frustration -_-.
    Last edited by Nomad_Tech; 13th September 2014 at 13:59.
    "When the only tool you have is a hammer, every problem resembles a nail"

Similar Threads

  1. Replies: 2
    Last Post: 9th November 2012, 13:29
  2. Linking Qt-libs static
    By Simo in forum Qt Programming
    Replies: 1
    Last Post: 5th December 2011, 11:06
  3. Split project into shared libs - linking issue.
    By porterneon in forum Newbie
    Replies: 9
    Last Post: 30th May 2011, 14:15
  4. Linking 3rd party libs on Mac OS X
    By jonks in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2010, 06:03
  5. Linking against different Libs
    By AlphaWolf in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2009, 15:25

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.