Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using dll + lib files in Qt Application
b1ck0 last edited by
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"@
@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!
AcerExtensa last edited by
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:
typedef void (*MyPrototype)();
MyPrototype myFunction = (MyPrototype) myLib.resolve("mysymbol");