[Mono-dev] C++, COM interop
QbProg
tholag at gmail.com
Mon Jan 19 04:19:09 EST 2009
Hello Mono users and developers!
I have a native C++ class library , a COM wrapper written in ATL and a .NET
wrapper written in C++/CLI.
Now, I'm thinking how it would be possible to write a mono wrapper that runs
mainly in LINUX.
Basically I see two suggested ways:
- Write a flatten "C" version on the library and use P/Invoke
- Use SWIG to do such a thing
I don't like neither of these, since the wrapper has many functions and
classes.
I see a better in using a sort of COM / XPCOM interfaces.
I have no problems in making the wrapper based on interfaces (like I did for
the COM one). The only thing that I can not use are class factories since
COM is not available in Windows. Hoever , I've got no problem in eventually
writing a custom factory for required COM Classes.
I see that there is a main difference between COM and XPCOM interop. (?)
In com you can write
CClass c = new cClass ()
and the COM layer will call the relative class factory. In XPCOm you have to
call manually a function to create the class.
The question is : is there a way to redirect the "new" for a COM class (in
linux) so I can directly call a custom class factory function (this time
"internal") ?
I.e.
COMClass C = new COMClass;
i.e. instead of calling CoCreateObject should call an internal function
CreateCOMClass ?
I don't know if I made it clear...
I'll continue trying, and I'll share my experience, so maybe users can find
an additional way to wrap C++ classes.
Thank you.
QbProg
--
View this message in context: http://www.nabble.com/C%2B%2B%2C-COM-interop-tp21539294p21539294.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list