开发者

how to access char*** from dll import in C#

I h开发者_StackOverflow社区ave a function in win32 dll with signature as:

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

int a --> input parameter

char*** outData --> output parameter - pointer to array of char strings

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


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

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

Once this function returns the IntPtr value will essentially represent a char**.

Using that value is nearly impossible though because we don't know the length. You'll need to alter your function signature to pass back out the length of the array before it can be used in managed code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜