Click here to Skip to main content
12,305,151 members (73,537 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

9.5K views
4 bookmarked
Posted

Export C++ to VB.NET

, 28 Mar 2010 CPOL
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)

Share

About the Author

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

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 4 Pin
Karay AKAR - Yapar6-Feb-13 3:46
memberKaray AKAR - Yapar6-Feb-13 3:46 
GeneralRe: My vote of 4 Pin
Ozan Müyesseroğlu10-Feb-13 15:28
memberOzan Müyesseroğlu10-Feb-13 15:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 28 Mar 2010
Article Copyright 2010 by Ozan Müyesseroğlu
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid