Is it possible to build a .NET assembly callable from a native assembly writing in C# alone without using COM?
views:
200answers:
3Or a wrapper written in managed C++.
0xA3
2009-08-07 15:54:57
Exactly. What we do is create a thin wrapper with standard extern "C" exports in Managed C++, then write the real code in C#.
consultutah
2009-08-07 16:34:00
+1
A:
Without using COM, you have to write a C++/CLI wrapper. Your native code that includes the header file of your wrapper needs to be compiled with /clr (common language runtime support).
Just for curiosity, why not using COM interop? Check out the regasm.exe and tlbexp.exe tools.
mqbt
2009-08-07 16:25:38
Because I am not familiar with COM and will do everything I can to avoid learning it :)
beef
2009-08-07 21:24:37
COM also suffers from the nasty DLL hell problem due to global registration. It's possible to do registration-free COM but the documentation is confusing and there are bugs http://stackoverflow.com/questions/617253/is-anyone-successfully-using-registration-free-com-with-net-components
Wim Coenen
2009-09-05 01:46:18
+2
A:
You need something to make the managed world and the unmanaged world work together. If you don't want to use COM, you can create wrapper classes in C++/CLI.
Here is an article that can get you started: .NET to C++ Bridge.
Steph
2009-08-07 21:21:07