Is there a way to automatically create p/invoke wrappers for .net from a c header?
Of course I could create them by hand, but maintaining them would be painful, and I'd probably make a mistake somewhere resulting in hard to debug crashes.
I tried SWIG, but it created full classes where simple structs would be sufficient. Another problem with SWIG is that it requires additional interop code on the c side.
I'd prefer if the output worked on mono too, but that is not necessary.
Another thing I could work with is a program which parses the c header, and creates an output in a nice intermediate format like xml, from which I can create the C# wrapper myself.
Edit:
PInvoke Interop Assistant is what I needed.
There are some small issues with it though:
* It translates "unsigned char*" to string where I'd prefer IntPtr
* It assumes that size_t=int=long=32bit. This is currently true for me, but might not true on every platform.
Is there a clean way to fix that? Else I'll use a bit of find and replace on the c code before converting it.