作者stellvia7 (stellvia)
看板C_Sharp
標題[問題] 關於 c# dllimport dll 傳入 char* 參數
時間Mon Jan 11 18:52:34 2010
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
1F:推 jhchou:MSDN 查 MarshalAsAttribute Class 01/11 19:41
2F:→ stellvia7:對了我是在wince 上平台.. 01/11 20:08