segfault registering functions returning pointer
Brought to you by:
justin_reynen
Registering following C function:
char* test( int i )
{
return strdup("bleh");
}
like this:
CLU_Init();
CLU_RegisterFunction( "test", "char*", "int", CLU_CDECL,
CLU_CAST( test ) );
results in:
Program received signal SIGSEGV, Segmentation fault.
0x10003eba in CaLua!CLU_Init () from
/cygdrive/c/WINDOWS/CaLua.dll
in the line containing CLU_RegisterFunction.
Instead char* there can be pointer to any type or
structure, it's alwyas crashing. I'm using cygwin
environment. How can I pass some string (char*) from C
function to LUA script?
It's working ok when returning simple int for example.