How to access char *** from dll import in c #

I have a function in win32 dll with a signature like:

void func1(int a, char*** outData) 

int a -> input parameter
char *** outData -> output parameter - pointer to an array of char strings


Any idea how to access this in C # using dll import and what should be a signature.

+4
source share
1 answer

For complex types like triple pointers, I find the best approach is to go simple and marshal it as simple as IntPtr

 [DllImport("Some.dll")] private static extern void func1(int a, out IntPtr ptr) 

Once this function returns an IntPtr value, essentially char** will be displayed.

Using this value is almost impossible because we do not know the length. You will need to change your function signature to pass the length of the array before it can be used in managed code.

+2
source

Source: https://habr.com/ru/post/1305304/


All Articles