* marcelo nicolet: > This answer was right: -Wl, -E did the trick. > > Now, being the function create_thread( char * ), and calling it as > C.create_thread( lua_string ) it gives > > ./mainthread: second.lua:33: bad argument #1 to 'create_thread' (cannot > convert > 'string' to 'char *') > > What can I do? How can I convert the lua string to char* You need to call strdup (and free the pointer somewhere) if the create_thread function indeed modifies the argument string. Otherwise, it is sufficient to change the type of the argument to “const char *” (both in the Lua declaration and the C implementation). Lua strings must not be modified, and the C type system enforces this for once. (ffi.cast is the wrong way to tackle this.)