Exporting a native C function from a .net DLL?

Andrew picture Andrew · May 13, 2011 · Viewed 8.6k times · Source

I have a .net assembly written in C#, and I'm looking to export a native C function from the assembly.

I have an application which will perform a 'LoadLibrary()' on any DLL's found in a 'plugin' folder. After loading the DLL, the application performs a 'GetProcAddress' looking for a function named 'Register'. The application expects this function to follow the C calling convention.

How can I export a function named 'Register' from my .net assembly, so I can successfully hookup with the plugin system for this application?

Thanks, Andrew

Answer

SLaks picture SLaks · May 13, 2011

Use this tool.