Hi,
I'm trying to return a string from a c++ dll in a method I load from VB.NET.
This is the method is defined like this:
extern "C" __declspec(dllexport) LPSTR GetData(BSTR hostExport, int
portExport)
The code I use for returning the string is this:
....
LPSTR lpReturnStr;
lpReturnStr = (LPSTR)malloc(strlen(csRef) + 1); //csRef is a CString
strcpy(lpReturnStr, csRef);
return lpReturnStr;
My question is, if the second line will cause a memory leak, as I do not
manually release the memory created by malloc.
Does the caller (in this case, the VB.NET application) free the string, or
should I do this in an other way?
Thanks