Ly Quoc Phong
Ly Quoc Phong

Reputation: 1

Trouble with loading C dll in Qt

I am newbie in Qt, I have dll from 3rd party (NFC reader), this is C Win32 library (I don have header file, only dll file) so in C# i call it by using DLLImport Attribute. Now I want to using Qt to make the application and I don know how to do it. I hope somone will help me. Please explain clearly because I am very very fresh with Qt.

Thank you so much

Upvotes: 0

Views: 124

Answers (1)

  1. Use QLibrary to load the library - it's a bit easier than using the native API (LoadLibrary etc.).

  2. Use resolve("symbolname") on the QLibrary instance to get a pointer to a particular function. You then need to cast that pointer to the signature of the function you're actually going to call, and call via this cast pointer.

The documentation for your NPC Reader's DLL should describe the signatures of the functions, you needed that information for C# anyway.

Upvotes: 1

Related Questions