[問題] 關於 c# dllimport dll 傳入 char* 參數

看板C_Sharp作者 (stellvia)時間16年前 (2010/01/11 18:52), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/2 (看更多)
dll 中 int go_capture(char *name) { printf("the name = %s\d",name); } c# 中 [System.Runtime.InteropServices.DllImportAttribute("test.dll")] private static extern int go_capture(char *name); ... ... ... void button_click(....) { string abc="temp_name"; go_capture(abc); } 上述 go_capture的用法我知道是錯的 但我try很久 有的說用unsafe 有個要用Inptr轉型 但是一直失敗 可以煩請指點嗎.. 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.130.36.18

01/11 19:41, , 1F
MSDN 查 MarshalAsAttribute Class
01/11 19:41, 1F

01/11 20:08, , 2F
對了我是在wince 上平台..
01/11 20:08, 2F
文章代碼(AID): #1BImBqCz (C_Sharp)
文章代碼(AID): #1BImBqCz (C_Sharp)