How can I pass a char * from C dll to VB
Here is sample code:
void Cfunc(char *buffer,int len)
{
BSTR buf_bstr = SysAllocString((BSTR)buffer);
V
This is the code I wrote using sharptooths answer
int wslen = MultiByteToWideChar(CP_ACP, 0, str, strlen(str), 0, 0);
BSTR bstr = SysAllocStringLen(0, wslen);
MultiByteToWideChar(CP_ACP, 0, str, strlen(str), bstr, wslen);
// Use bstr here
SysFreeString(bstr);
Note that using -1 for the length of the string results in the null terminator being included in the result