Reputation: 4244
i have a C function with this prototype:
void foo(const char **output);
i compiled C file into a DLL and a i make DllImport("my.dll");
but how should i write c# prototype?
Thank you very much!
Upvotes: 2
Views: 1078
Reputation: 81700
That will be a Pointer to byte array:
private static extern void foo(IntPtr pointerToByteArray);
Usage:
fixed(byte* buffer = new byte[LENGTH_WHICH_YOU_KNOW_IS_ENOUGH])
{
IntPtr ptr = new IntPtr(buffer);
foo(ptr);
}
Upvotes: 2