看板 C_Sharp 關於我們 聯絡資訊
自回了 我是不知道怎麼在dllimport時怎麼宣告... 網路上找了老半天,又跑去查msdn,有看到是用delegate 是先宣告一個 delegate int mydelegate(string str); [System.Runtime.InteropServices.DllImport("DLL.dll")] public extern static int _DLL_StatusFunc(mydelegate t); 其實昨天有想到這樣做,不過昨天怎麼沒寫出來,鬼擋牆了... ※ 引述《dm33 ()》之銘言: : 因為有用到dll,原本此dll是用c++來使用的,所以用到不少指標的東西 : 一般的function是可以使用,就是參數是指標函數的,就不知道怎麼在 : C#裡處理了。 : 如 : int _DLL_StatusFunc (int (*statusfunc) (char *)); : c++裡是直接 : extern "C" __declspec (dllimport) _DLL_StatusFunc (int (*func) (char *)); : 使用的時候 就放函數就行了 : 而C#就不知道怎麼改了~~有大大能幫忙解答一下嗎 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.126.238