2010-12-15 90 views
0

我已經嘗試了很多東西,但是我無法得到它的工作。我可以向C++傳遞並接收普通字符串(char *),但我無法接收C++中的Unicode字符串(w_char_t *)。將unicode字符串從VB.net傳遞到C++ dll

下面是C上的碼的一些比特++

__declspec(dllimport) int __stdcall readFile(const w_char_t *file_path) 

上VB.net

Public Declare Function readFile Lib "MyDll.dll" Alias "[email protected]" (ByVal file_path As String) As Integer 

當我改變w_char_tchar我收到正確的字符串。

我發現在VB6了大量的素材,而不是VB.net

任何幫助極大的讚賞。

萊昂

回答

0
Public Declare Unicode Function readFile Lib "MyDll.dll" Alias "[email protected]" (ByVal file_path As String) As Integer 

另外,你的C++代碼有dllexport沒有dllimport,對不對?

+0

這有幫助。非常感謝。 (也稱dllexport) – Leon 2010-12-15 07:53:31

0

嘗試變換的UnicodeString到字符串(通過使用一些系統定義的功能),並且然後將該字符串或字符*到C++ DLL。

希望這會起作用。

相關問題