Please see this code:
Extern "C" __declspec (dllexport) char * __stdcall getStr (char * DDD)
{
Char * DDAA = "wwwwww"; return ddaa;
}
This is written, but there is no problem, but when the VB is called, it is empty.
The VB code is as follows:
Private Declare Function GetStr Lib "DLL2.DLL" (Byval Variable As String) AS STRING
Private sub fascist2_click ()
MSGBOX GetStr ("Sadfsad")
End Sub
Try it with this:
Char * ddaa = "wwwwww";
Maybe this is a problem, try the DDAA New a space, and assign it.
code show as below:
Extern "C" __declspec (dllexport) char * __stdcall getStr (char * DDD)
{
Char * ddaa = new char [6];
DDAA = "wwwwww";
Return DDAA;
}
Or not! Try again, use _TCSCPY ().
DDAA = "wwwwww";
Change to _TCSCPY (DDAA, "Wwwww");
Try it immediately.
success!