tags:

views:

31

answers:

1

I need to be able to call .NET 3.5 managed code in a DLL from native C. I was not provided with .h or .lib files.
I've tried making a C++ DLL to expose a C-compatible interface but I don't seem to be able to include the DLLs I need to use in my project.

Is there any way to call .NET managed code from native C?

+4  A: 

Pure managed code will never provide you a header or library - it relies on the .NET framework's metadata abilities instead for the compiler to determine the appropriate API.

The easiest way to use a managed assembly from C is to use C++/CLI to make a native wrapper around the managed code. You can then expose a C API from this DLL, and call into it like any other C/C++ DLL.

Reed Copsey
Alright, thanks for the info.In Visual Studio 2008, I would create a Class Library project to do this, right?
Eric Finn