It's purpose is to go beyond the limitation of DllImportAttribute and make available (understand: usable in .NET code) most of the function pointer deliver in your legacy library.
IntPtr pfct = GetC_DisplayArray_CallbackFct();
CFunctionPointer p = CFunctionPointer.Create(pfct, // function pointer
typeof(void), // return type
typeof(int[]), typeof(int)); // param type
p.Invoke(new int[]{1,2,3,4}, 4);
It has the following type support
| Type | Supported |
|---|---|
| value (int, double, etc..) | YES |
| pointer (int*, ...) | NO use array |
| ref / out | NO use array |
| array ([], [,], ..) | YES/NO array of value type only |
| struct | YES of course, it's a value type |
| class | NO |
In its current state the Emit code is quite good but the marshalling need to be improved.