2016-08-29 1 views
0

Comment renvoyer correctement un char * d'une DLL non gérée à VB .net et l'utiliser comme une chaîne dans VB? De a similar post for C# and C++ il semble que la syntaxe C# pour faire une telle chose estComment renvoyer correctement un char * à partir d'une DLL non managée écrite en C vers VB .net?

[DllImport("api.dll")] 
[return : MarshalAs(UnmanagedType.LPStr)] 
internal static extern string errMessage(int err); 
... 
string message = errMessage(err); 

Est-ce que VB .net ont une syntaxe correspondante?

Répondre

0
<DllImport("Project1.dll", SetLastError:=True, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)> 
Function agmemwrite(graph As IntPtr) As <MarshalAs(UnmanagedType.LPStr)> String 
End Function