Call .NET C# dll from QT ?
I'm new in C++ and QT and I need some help.
I have built a com object (not something visual) with some methods and the task is to call my .NET C# dll from inside QT (a console application or even a Windows Application).
I read the documentation and tried unsuccessfully to make that call happen.
but without success.
Can anyone has a small snippet of code on how to do this in QT ?
Is QT supports that ?
I tried to use this
but I got an unresolved something
I tried this
QLibrary lib( "C:\Myfolder\MyCOM.dll" );
but it was not loaded.
I ran out of ideas .
Appreciate any help you could give me.
thank you in advance
I have tried this
bool okLoad = mylib.load();
bool loaded = mylib.isLoaded();
and both bool return true
So, that means that the dll is loaded ?
And Now how can I call a method from the Com Object ?
You need to resolve the functions you would like to call in the dll. The "QLibrary documentation":http://qt-project.org/doc/qt-5/QLibrary.html shows an example.
Create a typedef for the function prototype, then resolve the function by name.
C# DLL cannot directly called like C++ DLL's. So QLibrary cannot be used.
You can use QAxObject, but your C# DLL need to export COM objects (Interop) which is not enabled by default during compilation.
I apologize, you are correct. QLibrary is only for C.
There is a good example on the QAxBase docs "here":https://qt-project.org/doc/qt-4.7/qaxbase.html, although I have only used QAxObject to populate Microsoft excel documents