我有C++ dll的類,我想從C#代碼發送字符串,surly我不能使用字符串,因爲CLR,我會努力將字符串更改爲C++ dll中的字符,並且從c#發送字節(因爲在c#中的c + +字節=字節),但c#不理解c + +數組我可以發送1字節,它會好的,但不是數組,請幫助! DLL代碼:在C#中使用C++代碼
public ref class Coding
{
public:
void HillCoding(char filePath[])
{
...
}
};
你可以與我們分享C++函數的簽名嗎? – Raphael 2010-11-06 21:17:26
在'P/Invoke'的運行時,CLR會將'string'轉換爲'char *'我相信 – 2010-11-06 21:17:51
[將非空終止的字符串傳遞給非託管代碼](http://stackoverflow.com/questions/ 3435163/passing-non-null-terminated-strings-to-unmanaged-code) – Hogan 2010-11-06 21:18:48