询问者
WP8.1中C#如何通过运行时组件向C++的dll(WP8.1)传递回调?

问题
-
我有个dll(WP8.1),里面有个回调函数如下:
__declspec(dllexport) void SetTsEventCallback(TsEventCallback *pFunc, const int id = 0);
typedef void __stdcall TsEventCallback(const int statusCode, const char * message);
运行时组件中的方法如下
public delegate void WRT_TsEventCallback(int statusCode, Platform::String^ message);
void Class1::WRT_SetTsEventCallback(WRT_TsEventCallback^ wrt_TsEventCallback, int id)
{
SetTsEventCallback(wrt_TsEventCallback, id);
}现在目标是在C#(WP8.1)中,向dll传递回调,现在我知道如何向运行时组件传递回调,但不知道如何在运行时组件中向dll传递回调,直接如前述划线部分调用貌似不行,形参类型不兼容,那应该怎么传递呢?或者dll中回调的申明应该怎么做?
- 已编辑 九门提督 2015年8月17日 1:13 写漏了
全部回复
-
你好,
在dll里面你试试这么定义:
__declspec(dllexport) void SetTsEventCallback(TsEventCallback *pFunc, const int id = 0);
具体解释在MSDNhttps://msdn.microsoft.com/zh-cn/library/a90k134d.aspx
我记得应该是这种方式来定义
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.