[問題] C# 傳function pointer 給c++ dll
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC 2008
問題(Question):
請問如果想要從 C# 傳一個 callback function 給 C++ dll
讓 C++ 可以call 回 C#
這樣該怎麼做呢??
我試了很久一直都有問題 煩請有經驗得大大幫忙
謝謝
CODE:
C# 層寫法
宣告:
public delegate void sizeChanged(int width, int height);
定義:
public void OnSizeChanged(int width, int height)
{
}
使用:
cpp_dll.setSizeChangedCB( OnSizeChanged );
C++ 層寫法
public ref class NativeDecoder
{
public:
void setSizeChangedCB(void (*cb)(int,int));
}
錯誤結果(Wrong Output):
'setSizeChangedCB' is not supported by the language
請問是我哪裡寫錯了嗎?? 煩請指點
謝謝回覆
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.248.131.23
※ 編輯: tocute 來自: 60.248.131.23 (05/14 18:24)
※ 編輯: tocute 來自: 60.248.131.23 (05/14 18:24)
推
05/14 19:31, , 1F
05/14 19:31, 1F
→
05/14 20:28, , 2F
05/14 20:28, 2F