Calling a .NET library (.dll) from a Qt application
-
Hello,
I am conducting a research about text clustering and have found a third party library written in .NET. However, I haven't used .NET and am not familiar with VS .NET environments. I would like to use the library I found in my pure c++ application. I googled and found some possible ways to do that. For example "ActiveQt":http://developer.qt.nokia.com/doc/qt-4.8/activeqt-dotnet.html.
To be honest, I didn't find it useful for my purpose because it only demonstrates how Qt objects can be used in a .NET environment not how .NET objects can be used in a Qt environment.I have a few questions.
Should I modify the source code of the library I found such as making it a COM object?
If so, how?
I guess it's possible to call the library as a COM object from Qt. But I am not sure how to do that.Second question is, is there anyone who had a similar problem and have managed to solve it or is there any descriptive tutorial I can follow?
The question is pretty simple, I need to call a third party .NET dll in Qt.
Hope you can help me.
Thanks
-
Actually, I have achieved to use a simple C# library created in .NET in my Qt application without needing QAxObject or QAxWidget.
I just used @#import "myLib.tlb"@ keyword.
However, I cannot do the same things for a large library called WordNet.Net.
I also tried the other way around and attempted to run examples/dotnet/wrapper/wrapper.sln , but it gives an error.@1>------ Build started: Project: lib, Configuration: Release Win32 ------
1>Performing Custom Build Step
1>The system cannot find the path specified.
1>Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
1>Build log was saved at "file://e:\Qt\Examples\4.7\activeqt\dotnet\wrapper\lib\Release\BuildLog.htm"
1>lib - 1 error(s), 0 warning(s)@I don't know what to do with it but I will post here if I find a solution.
Thanks -
Hmm. your .NET assembly doesn't seem to carry tlb file.
If your .net assembly provides COM interop, you can generate your own tlb file using tlbexp.exe.
You can google this keyword 'tlbexp.exe" or "generate tlb from .NET assembly" ...BTW, if you know the CLSID, progid, .... of the component, I think it'll be easier to use dumpcpp.exe tool in Qt/bin than using #import ... primitive. dumpcpp can generate more Qt-stylish c++ wrapper.
Hope this helps