Click here to Skip to main content
11,565,623 members (47,099 online)
Click here to Skip to main content

Tagged as

Export C++ to VB.NET

, 28 Mar 2010 CPOL 8K 4
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    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
Web04 | 2.8.150624.2 | Last Updated 28 Mar 2010
Article Copyright 2010 by Ozan Müyesseroğlu
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid