Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using dll + lib files in Qt Application
QtWS25 Last Chance

Using dll + lib files in Qt Application

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    b1ck0
    wrote on last edited by
    #1

    Hi all,

    I have the following issue. I want to use one external library which was written in FORTRAN. The guys which provide the library simply provide two files -- one dll and one lib file. I have a very detailed description of the functions inside the library but I don't know how to use it. I've already prepared one simple console application. In the .pro file I've added:
    @LIBS += "C:\Documents and Settings\Vasil.Yordanov\My Documents\Qt working\Siftool\libs\siftooldll.lib"@
    and
    @INCLUDEPATH += "C:\Documents and Settings\Vasil.Yordanov\My Documents\Qt working\Siftool\libs"@
    I also placed the siftooldll.dll into the included folder. When I run the console application with only these two lines added to the pro file it compiles with no error but I still don't know if I can use the functions inside the library ... and more specifically I don't how how exactly I should call them.

    Thanks in advance!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      If it is compiled without errors, your library is linked successfully!

      bq. I have a very detailed description of the functions inside the library but I don't know how to use it.

      Functions or classes/interfaces? I guess it is collection of exported functions. You need to check if this exported functions are decorated or not. For example with this program: "DLL Export Viewer":http://www.nirsoft.net/utils/dll_export_viewer.html

      If exported functions are mangled, you should use following method to declare this functions:
      @__declspec(dllimport) int SomeFunctionFromLib(); // somewhere in header@
      after that you can use it as usual: @int i = SomeFunctionFromLib();@

      if functions in lib are unmangled you should better load this library dynamical instead of linking it.
      And use "QLibrary":http://qt-project.org/doc/qt-4.8/qlibrary.html to resolve functions:
      @
      QLibrary myLib("mylib");
      typedef void (*MyPrototype)();
      MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol");
      if (myFunction)
      myFunction();
      @

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved