If you want to export strings in C++ to VB.NET, build your function like this:
BSTR __stdcall expfun(void)
{
char* cp_test = "Hi World!";
CString cs_test;
cs_test.AppendFormat(L"%s", cp_test);
return cs_test.AllocSysString();
}
and in VB.NET:
Imports System.Runtime.InteropServices
.
.
.
<DllImport("dll_path", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.None)> _
Public Shared Function expfun() As String
End Function