如何正确地将char *从非托管DLL返回到VB .net并在VB中将其用作字符串? 从a similar post for C# and C++看来,执行此类操作的c#语法是
[DllImport("api.dll")]
[return : MarshalAs(UnmanagedType.LPStr)]
internal static extern string errMessage(int err);
...
string message = errMessage(err);
VB .net是否有相应的语法?
答案 0 :(得分:0)
<DllImport("Project1.dll", SetLastError:=True, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)>
Function agmemwrite(graph As IntPtr) As <MarshalAs(UnmanagedType.LPStr)> String
End Function