Linking and calling a .NET com dll written in C# from MSVC++ 2010 Express
I have a console for windows app developed in MSVC++ 2010 Express. I have to use a third party library which has been supplied as a DLL which was written as a .NET com and was developed in C#. I wanted to add a GUI on it, and a friend recommended Qt.
At first I started with the Qt Creator 5.0 using MingW32 (my friend's recommendation). When I got to the part where I needed to call the DLL I ran into problems. Googling around, I saw nothing on how to call this type of DLL, so I decided to back out the MingW32, and installed Qt to use my MSVC++ 2010 Express.
The application compiles and links and runs, but crashes. I did not install the add-in.
Do I have to install the add-in to use the debugger in Qt IDE? I saw notes somewhere that says the add-in will not work with the Express version I'm using. Is that true with Qt 5.X also?
Am I going about this all wrong? I wanted to reuse my working code that compiled, linked and worked under MSVC++ 2010 Express that uses this C# com .NET dll, because it was a pain to get it to work the first time. I don't really have access to the source code for the dll. I'm using regasm to create a tlb file and then using the #import command to get access to the dll.
Any help is appreciated. I saw lots of help for calling dll's of various kinds, but nothing like this (where I need to use Qt to call a C# .NET com dll).
If I can just get the debugger to work from inside Qt, that would help me figure out why the code is crashing (maybe!).
Did I post this to the wrong group? I'm very new here. Any help would be appreciated.
Is it a dumb question? Hard question?
Why has nobody replied?
If I need to post more information, I'd be glad to.
Hi, and welcome to the Qt Dev Net!
This is the correct place to post "how to link XYZ to Qt?" questions. However, note that it is perfectly normal for a few days to go by before a question is answered.
Remember also that Qt users are mostly C++ developers, so there might be few (or no) people here who know the answer to your question. I have no experience with C# or .NET so I can't help you fully, but I'll answer what I can.
[quote]At first I started with the Qt Creator 5.0 using MingW32 (my friend’s recommendation). When I got to the part where I needed to call the DLL I ran into problems[/quote]As a general rule, if you want to link 2 binaries together, they need to be built with the same compiler. Therefore, your Qt GUI should also be built with the compiler that produced your DLL (MSVC 2010).
[quote]Do I have to install the add-in to use the debugger in Qt IDE?[/quote]The Visual Studio Add-In is for people who want to use Visual Studio as the IDE. It is not needed if you use the Qt Creator IDE.
To use the debugger, you need to install the debugger (which is Debugging Tools for Windows in your case).
[quote]I saw notes somewhere that says the add-in will not work with the Express version I’m using.[/quote]Correct. That is because Microsoft disabled add-ins for the Express versions of their IDE. It has nothing to do with Qt.
[quote]I wanted to reuse my working code that compiled, linked and worked under MSVC++ 2010 Express that uses this C# com .NET dll....
I saw lots of help for calling dll’s of various kinds, but nothing like this (where I need to use Qt to call a C# .NET com dll).[/quote]Qt is a standards-compliant C++ library. If you can find any info about calling a .NET DLL from a "plain" (unmanaged, non-.NET) C++ program, then you can apply that to your Qt GUI.
Thank you! This helped.
It looks like my next step will be to install the debugger and look into why the code is crashing. What threw me off, was that the MingW32 version of Qt installed with the debugger included. I didn't have to go through another installation package. I'll hunt down the debugging tools for windows and install them.
See these threads: