"pi**********@gmail.com" <pi**********@gmail.com> wrote:
Hi All,
Is it possible to export a c# method into a dll in such a way that your
"normal" C application can then call this method?
To be clear: I am not asking how to use "DllImport" or PInvoke. My
question is the other way around.
Regards
Pieter Breed
I'm afraid the simple answer is no.
UNLESS you are willing to have COM invade your C application
and aren't afraid to manipulate the COM interfaces exposed
by the COM Callable wrapper (CCW; created with Regasm.exe)
manually.
Not pretty...
NET Framework Tools Assembly Registration Tool (Regasm.exe)
http://msdn.microsoft.com/library/de...lregasmexe.asp
..NET Framework Developer's Guide Registering Assemblies
with COM
http://msdn.microsoft.com/library/de...ieswithcom.asp
..NET Framework Developer's Guide: Exposing .NET Framework
Components to COM
http://msdn.microsoft.com/library/de...nentstocom.asp
If your going down that road you may want to invest in:
COM and .NET Interoperability
by Andrew Troelsen
769 pages
Apress; 1st edition (April 20, 2002)
ISBN: 1590590112
http://www.amazon.com/exec/obidos/ASIN/1590590112 http://www.apress.com/book/bookDisplay.html?bID=81 http://www.apress.com/book/supplemen...bID=81&sID=371
It contains a concise rundown on how COM works (and why it
was put together that way). And of course it discusses many
of the .NET interop attributes that influence how the CCW is
generated (which only helps if you own the source to the
..NET assembly).