When I wrote the article "Marshalling: Using native DLLs in .NET", I had no clue that so many people have problems using native DLLs in managed code. I receive comments and email very frequently about this topic. Most of the times people ask me to help them writing the C# code that does the import of the unmanaged DLL.
To keep the story short... I'm in the process of writing a Marshalling Compiler (of some sort). It's an online compiler which takes a C style header as input and delivers C# code as output. This C# output code consists of function imports, struct definitions and enum definitions.
Know that it's not a perfect compiler and it probably never will be. Though I'll try to keep improving the functionality until most people can use it.
Go to the Marshalling Compiler
For more information on Marshalling in general, please read "Marshalling: Using native DLLs in .NET"
If you encounter any errors which shouldn't occur, please post your comments on this page. But before you do, please first check if your C style header is correct and please also check that the error wasn't reported by someone else.
version 0beta1:
This is the initial version on the web. It converts a C style header, but the output is simple. It still lacks the generation of code that will dereference pointers and so. Please use it to test it. There is also a test header file for download at the compiler page.
Remember Me
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.