|
|
|
@ -936,7 +936,22 @@ static const char zmq_ffi_lua_code[] = "local ffi=require\"ffi\"\n"
|
|
|
|
"local p_config = package.config\n"
|
|
|
|
"local p_config = package.config\n"
|
|
|
|
"local p_cpath = package.cpath\n"
|
|
|
|
"local p_cpath = package.cpath\n"
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"local function ffi_load_cmodule(name, global)\n"
|
|
|
|
"local ffi_load_cmodule\n"
|
|
|
|
|
|
|
|
"\n"
|
|
|
|
|
|
|
|
"-- try to detect luvit.\n"
|
|
|
|
|
|
|
|
"if p_config == nil and p_cpath == nil then\n"
|
|
|
|
|
|
|
|
" ffi_load_cmodule = function(name, global)\n"
|
|
|
|
|
|
|
|
" for path,module in pairs(package.loaded) do\n"
|
|
|
|
|
|
|
|
" if type(module) == 'string' and path:match(\"zmq\") then\n"
|
|
|
|
|
|
|
|
" local C, err = ffi_safe_load(path .. '.luvit', global)\n"
|
|
|
|
|
|
|
|
" -- return opened library\n"
|
|
|
|
|
|
|
|
" if C then return C end\n"
|
|
|
|
|
|
|
|
" end\n"
|
|
|
|
|
|
|
|
" end\n"
|
|
|
|
|
|
|
|
" error(\"Failed to find: \" .. name)\n"
|
|
|
|
|
|
|
|
" end\n"
|
|
|
|
|
|
|
|
"else\n"
|
|
|
|
|
|
|
|
" ffi_load_cmodule = function(name, global)\n"
|
|
|
|
" local dir_sep = p_config:sub(1,1)\n"
|
|
|
|
" local dir_sep = p_config:sub(1,1)\n"
|
|
|
|
" local path_sep = p_config:sub(3,3)\n"
|
|
|
|
" local path_sep = p_config:sub(3,3)\n"
|
|
|
|
" local path_mark = p_config:sub(5,5)\n"
|
|
|
|
" local path_mark = p_config:sub(5,5)\n"
|
|
|
|
@ -951,6 +966,7 @@ static const char zmq_ffi_lua_code[] = "local ffi=require\"ffi\"\n"
|
|
|
|
" if C then return C end\n"
|
|
|
|
" if C then return C end\n"
|
|
|
|
" end\n"
|
|
|
|
" end\n"
|
|
|
|
" error(\"Failed to find: \" .. name)\n"
|
|
|
|
" error(\"Failed to find: \" .. name)\n"
|
|
|
|
|
|
|
|
" end\n"
|
|
|
|
"end\n"
|
|
|
|
"end\n"
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
"local _M, _priv, udata_new = ...\n"
|
|
|
|
"local _M, _priv, udata_new = ...\n"
|
|
|
|
|