PDA

View Full Version : Using Qt with third party hardware DLLs



hildebrand
25th March 2013, 05:11
Hi All,
I wish to use Qt to develop a GUI application and want to link it with DLLs with Card APIs from vendor. These are from Adlink, Moxa and some other companies. The examples they give are all for some old Visual Studio Application. I do not wish to use Visual Studio At all.
How does one interface these DLLs with a new Qt Application?
Any help or idea would be appreciated.
I tried to get in touch with the vendor but they have not replied.

Lesiok
25th March 2013, 07:39
This same way like every other library. Qt is not a magic. This is a C++ library too.

hildebrand
30th August 2013, 13:03
Let me be more specific about my query.
The driver libraries have 99.99% been made with some version of Visual Studio and I have Qt with mingw installed.
Do these type of DLLs work with the mingw installation or will work with a VS version only?
I have earlier integrated third party qserialport which has a .so file generated by compiling with the linux qt which was not a problem.
Hope my query is more clear now and I will get the correct reply.

hildebrand
18th September 2013, 13:26
I had been trying to sort out my problem with the Adlink Cards and finally understood how to go about it. I thought I will post the details here so that someone else with the same problem need not struggle.

I tried this out with 5.1.1 version of QT with mingw build system. I installed the required Adlink drivers also. You must ensure the drivers are correctly installed.

I made the following entries in the .pro file (my project was made in qt creator as a normal console program but should work with qt projects too).

win32:LIBS += C:/ADLINK/PCIS-DASK/Lib/PCI-DASK.lib
INCLUDEPATH += C:/ADLINK/PCIS-DASK/Include
DEPENDPATH += C:/ADLINK/PCIS-DASK/Include

For some strange reason, I had to give these absolute paths. Using the qtcreator options strangely did not work for me in this case. I wonder why giving the location with LIBS += -L/to/path -lPCI-DASK was not working (that directory has PCIS-DASK.lib and PCIS-DASK.dll).

Also, when trying to add the header file and write code, I found I was getting some compile errors as BOOLEAN, VOID and HANDLE were not defined.

Your declaration in the source file should look as follows for it to compile seamlessly:-

typedef bool BOOLEAN;
typedef void VOID;
typedef long HANDLE;

Regarding my query about whether different DLLs will work with mingw qt or not, I have bit more clarity.
It seems there are two types of DLLs (I maybe explaining a bit non-technically). One are DLLs which export parameter names as C(plain) names. These type of DLLs shall work with both MSVC Qt as well as MINGW Qt. The second type are libraries which export C++ objects (mangled names). In this case, we must match the compilers (This almost mandates the use of MSVC if the third party libraries are this type).

This is my understanding of the thing. Hope this will help someone else grappling with the same issue.