[問題] c#要如何引用c++不定參數function呢

看板C_and_CPP作者 (饕餮)時間11年前 (2014/04/24 11:15), 11年前編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
大家好 最近應用是想要利用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

04/26 09:37, , 1F
推分享
04/26 09:37, 1F
文章代碼(AID): #1JM874cn (C_and_CPP)