看板
[ C_Sharp ]
討論串[問題] C#使用C++ dll之回傳char
共 5 篇文章
內容預覽:
那是錯誤寫法而且也不 work well. 注意他是寫 char testStr[]="Hello World!";. 所以他 return testStr; 時,就是回傳放在 stack 上字串的起始位址. 而不是字串常數 "Hello World" 在 constant pool 中的位址. 離
(還有225個字)
內容預覽:
這個寫法就算在 C/C++ 都是錯的呀 @_@. 你的 return type 是 char*, 可是你卻 return char. 就算你是要 return testStr 的字串好了 (即 testStr),. 可是該字串的內容是配置在 test 的 call stack中, 一但 return
(還有169個字)
內容預覽:
在C++ dll 程式概述如下:. char * test(void). {. char testStr[]="Hello World!";. return *testStr;. }. 在C#宣告如下:. static extern byte[] test(void);. 在C#使用如下:. try
(還有259個字)