If you believe that the problem is with passing the string, then test with this code:
Code:
extern "C" __declspec(dllexport) char *read_c(char* c)
{
static char res[2048];
res[0] = '\0';
strcat(res, c);
return res;
}
Any difference? Notice that I removed the comment because this is literally the entire implementation of read_c. Nothing else, no other code that you have not shown us. Do you still have the problem?
EDIT:
Oh, you should do more: #include <assert.h> and #include <string.h> and do a pre-condition check:
Code:
extern "C" __declspec(dllexport) char *read_c(char* c)
{
static char res[2048];
assert(c && strlen(c) < sizeof(res));
res[0] = '\0';
strcat(res, c);
return res;
}
But given that you're testing with "Hi world" this probably doesn't matter right now.