Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转换并调用C++;STDCALL到C# 我有这个C++代码定义: static void STDCALL HandleVideoStatic(PVOID pContext, BYTE * apData[3], VideoSampleInfo_T * pVSI) { ((TMediaCallbackHandler *)pContext)->HandleVideo(apData, pVSI); }_C#_C++_Struct - Fatal编程技术网

转换并调用C++;STDCALL到C# 我有这个C++代码定义: static void STDCALL HandleVideoStatic(PVOID pContext, BYTE * apData[3], VideoSampleInfo_T * pVSI) { ((TMediaCallbackHandler *)pContext)->HandleVideo(apData, pVSI); }

转换并调用C++;STDCALL到C# 我有这个C++代码定义: static void STDCALL HandleVideoStatic(PVOID pContext, BYTE * apData[3], VideoSampleInfo_T * pVSI) { ((TMediaCallbackHandler *)pContext)->HandleVideo(apData, pVSI); },c#,c++,struct,C#,C++,Struct,并将其传递给一个方法(无需初始化) 如何将上述HandleVideoStatic转换为C#代码。以及如何在C#?中调用它假设您有三个对象的指针需要传递给函数,您可以这样声明它: [DllImport("YOUR.dll", CallingConvention=CallingConvention.StdCall)] private static extern void HandleVideoStatic(IntPtr pContext, IntPtr apData, IntPtr pVSI);

并将其传递给一个方法(无需初始化)


如何将上述HandleVideoStatic转换为C#代码。以及如何在C#?

中调用它假设您有三个对象的指针需要传递给函数,您可以这样声明它:

[DllImport("YOUR.dll", CallingConvention=CallingConvention.StdCall)]
private static extern void HandleVideoStatic(IntPtr pContext, IntPtr apData, IntPtr pVSI);

有关详细信息,请参见。

在C#中,m_aMediaHandler[i]是一个类实例。如果我把它传递给IntPtr apData。VS显示错误“无效图形”。我想是因为我传递了一个类实例,而不是指针。但我必须将一个类实例传递到该位置:(你能给我更多的建议吗?所以你在C语言中有一个类?你不能把它传递给C++方法。你需要先启动相应的C++类(C++)。AcRethe那个对象的指针,然后传递给方法。我怎样做一个指针来指向类实例并把它传递给这个地方?我想实例指针会解决这个问题。我是C++的新手,所以我可以做所有的想法。很抱歉。非常感谢你。为你的立场和返回指针…我猜你应该谈谈谁写C++代码,以帮助您做到这一点。
[DllImport("YOUR.dll", CallingConvention=CallingConvention.StdCall)]
private static extern void HandleVideoStatic(IntPtr pContext, IntPtr apData, IntPtr pVSI);