Using C# via ActiveQt on Linux platform
I am starting on a new greenfield project that is targeting Windows 7 and Linux. Hence Qt.
However there is some code from a previous version of the software that is written in C# on Windows and I'm investigating how much of those existing libraries we could re-use. The C# libraries aren't likely to require much active maintenance but being able to reuse them could save us a lot of time.
Using Visual Studio 2010 I have told my C# projects to register for COM interop and compiled them. Then I run the "dumpcpp":http://qt-project.org/doc/qt-4.8/activeqt-dumpcpp.html utility on the compiled type library to generate code that Qt can use. This works fine on my Windows 7 machine and after adding @CONFIG += qaxcontainer@
to my Qt project file I can access my C# classes in Qt Creator. But when I port that code to my Red Hat Linux machine it wont build as it has dependencies on qaxobject and qaxwidet.h, which don't exist.
So is there a way to get ActiveQt generated code working on a Linux platform?
Or is there a different way to get existing C# code integrated into Qt that doesn't require ActiveQt?
Thank you folks.
In short, you can't ;-)
COM and ActiveX are features of Microsoft Windows Only.
You can try something like this guy:
But I guess it is not worth the hassle.
I could imagine it might work using Wine, but that would mean you'd basically just make the windows binary run on Linux. Using ActiveQt on anything other than windows is not supported.
Thanks for the replies gentlemen.
So it looks like there's no straight forward way to wrap the C# code for use by Qt if we want cross platform. I don't want to jump through too many hoops getting it working as that will probably just lead to problems with maintenance down the road.
Therefore I'm thinking, to keep it simpler, if we want to use some of the existing C# libraries we'll port them to C++ code as required. I've taken a look at a few of our classes and it's not a straight rewrite to C++ due to some of the features in C#, but the business logic has already been written and tested so we'll still be better off than if we had no existing code.
If it is pure C# code, you can try Mono and Qyoto , and skip COM and Active* things.