开发者

pinvoke c#: how can i map "const char **output"?

开发者 https://www.devze.com 2023-01-30 22:19 出处:网络
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\");

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!


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);
        }
0

精彩评论

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