[問題] 呼叫unmanaged C++ function

看板C_Sharp (C#)作者 (不是lolicon)時間17年前 (2008/06/24 22:46), 編輯推噓0(003)
留言3則, 3人參與, 最新討論串1/1
我想用DllImport的方法,假如我這個C++ function是做sorting, input是int array prototype是 void sort(int *buf, int count); 那我C#裡面用的型別應該要是什麼呢? [DllImport("test.dll")] protected static extern void sort(int[] buf, int count); 這樣可以嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.138.75.52 ※ 編輯: rollingcom 來自: 220.138.75.52 (06/24 22:51)

06/25 00:18, , 1F
可以
06/25 00:18, 1F

06/25 12:58, , 2F
記得要加extern "C" 減少困擾 XD
06/25 12:58, 2F

06/25 21:26, , 3F
我用DEF檔,好像可以不用管extern "C"的樣子:P
06/25 21:26, 3F
文章代碼(AID): #18OGZRw1 (C_Sharp)
文章代碼(AID): #18OGZRw1 (C_Sharp)