Click here to Skip to main content
Click here to Skip to main content

Export C++ to VB.NET

, 28 Mar 2010
Rate this:
Please Sign up or sign in to vote.
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...
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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ozan Müyesseroğlu
Software Developer (Junior)
Turkey Turkey
No Biography provided

Comments and Discussions

 
GeneralMy vote of 4 PinmemberKaray AKAR - Yapar6-Feb-13 3:46 
GeneralRe: My vote of 4 PinmemberOzan Müyesseroğlu10-Feb-13 15:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 28 Mar 2010
Article Copyright 2010 by Ozan Müyesseroğlu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid