Forgot to mention that in many cases using the DllImport attribute is not sufficent, the whole thing is not really that straight forward for example.
For unions that need to be passed you need to declare a struct with Layout type set to explicit,.
For pointers that have to be passed from managed to unmanaged it is essential that you pin it before you pass it (especially when the pointer is involved in a async callback into the managed code).
Quote:
quote:Originally posted by ssawe
Load it explicitly and make calls to the exported methods , before doing that you need to declare the exported functions in C# , look at PInvoke examples. or much rather look at www.pinvoke.net to get an idea of what i mean.
|