Include DLL without header



  • Hello,

    I have to write a small application in C++ with Qt. I am new on Qt. My app will communicate with a software. For the communication the software provider gave me some .dll files but without header.
    (I think theses .dll were built with Microsoft Visual Studio 2010 -> language C#, but I am not sure at all)

    I have done the same application in C# (on VS2015) this summer, and I am happy to translate this app in C++, but I don't find how include properly the .dll files. So I can't call functions from them.

    Please, can you help me with that?



  • For including a dll without a header you have to know the function names. For example you can use the DependecyWalker to get the function names. Then use the WinApi-Functions LoadLibraryand GetProcAddress to get the pointers to the functions.



  • If this dll was written in C#, then it's very likely a .NET dll. In that case, you'll need to do something like this:

    https://support.microsoft.com/en-us/kb/953836

    Or maybe write your own wrapper dll to expose the managed members in a non-managed way.

    If it's not, @sneubert is right. A more cross-platform approach would be to use QLibrary:

    http://doc.qt.io/qt-5/qlibrary.html



  • Thanks for your quick answers.

    I tried to look with DependencyWalker, but I have some difficulties to find classes and functions I need. There are thousands of functions in theses dll

    I will try tomorrow the solution for a .NET dll,hopefully I will make more progress by this way.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.