看板 C_and_CPP 關於我們 聯絡資訊
大家好 最近應用是想要利用c# 去呼叫 自已寫的c++ 不定參數function 如下 void SendCommand(const char* pFunction, ...){} 並且在c#中使用 [System.Runtime.InteropServices.DllImport("RemoteControlDll.dll", EntryPoint = "SendCommand")] public static extern void SendCommand(string pFunction, params string[] Value); 來呼叫該function,但一直會連結不對。 google上也找不太到相關的做法(或是關鍵字不對?)。 請問各位是否有類似的經驗呢? 謝謝 已解決 分享解法: void foo(my_struct_t x, ...); C#: [DllImport("mydll.dll")] public static extern foo(my_struct_t x, __arglist); Call from C# as: foo(x, __arglist(y, z)); 這樣才對 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.133.45.115 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1398309316.A.9B1.html ※ 編輯: icarus0508 (220.133.45.115), 04/24/2014 12:21:42
dontblame:推分享 04/26 09:37