|
|
|
|
@ -705,7 +705,12 @@ static int nobj_try_loading_ffi(lua_State *L, const char *ffi_mod_name,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n"
|
|
|
|
|
static const char zmq_ffi_lua_code[] = "local error = error\n"
|
|
|
|
|
"local type = type\n"
|
|
|
|
|
"local tonumber = tonumber\n"
|
|
|
|
|
"local tostring = tostring\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"-- try loading luajit's ffi\n"
|
|
|
|
|
"local stat, ffi=pcall(require,\"ffi\")\n"
|
|
|
|
|
"if not stat then\n"
|
|
|
|
|
" return\n"
|
|
|
|
|
@ -792,7 +797,7 @@ static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n"
|
|
|
|
|
" end\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" -- create new userdata\n"
|
|
|
|
|
" ud_obj = udata_new(ffi.sizeof\"obj_udata\", type_mt)\n"
|
|
|
|
|
" local ud_obj = udata_new(ffi.sizeof\"obj_udata\", type_mt)\n"
|
|
|
|
|
" local ud = ffi.cast(\"obj_udata *\", ud_obj)\n"
|
|
|
|
|
" -- init. object\n"
|
|
|
|
|
" ud.obj = obj\n"
|
|
|
|
|
@ -865,7 +870,7 @@ static const char zmq_ffi_lua_code[] = "-- try loading luajit's ffi\n"
|
|
|
|
|
" if c_obj == nil then return end\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" -- create new userdata\n"
|
|
|
|
|
" ud_obj = udata_new(size, type_mt)\n"
|
|
|
|
|
" local ud_obj = udata_new(size, type_mt)\n"
|
|
|
|
|
" local cdata = ffi.cast(\"void *\", ud_obj)\n"
|
|
|
|
|
" -- init. object\n"
|
|
|
|
|
" ffi.copy(cdata, c_obj, size)\n"
|
|
|
|
|
|