JNA simple function call works on linux (x64) but not on windows (x86)
问题 I am trying to run the following C function from Java using JNA, but I get an error (Invalid memory access) on x86 windows (DLL) but not in x64 linux (.SO). c function char* testcopy(char* out,char* in) { strcpy(out,in); free(in); return out; }; C test: works in both platforms (Eclipse CDT/MVC++) When the function is exposed via linux shared library or windows dll and called directly in C, result is OK. ... char out[10]; char* res; char* in = (char*)malloc(3*sizeof(char)); strcpy(in,"ab");