App*_*ell 6 c++ lua embedding luajit lua-api
使用最近的luaJIT lua_open返回null.常规的lua库不会发生这种情况.
lua_State *L = lua_open();
std::cout << L << std::endl;
Run Code Online (Sandbox Code Playgroud)
输出: 0x0
我怎样才能让luaJIT工作?
SSCCE:
#include <iostream>
#include <luajit-2.0/lua.hpp>
//linked library: libluajit-5.1.a
int main(int argc, const char * argv[])
{
lua_State *L = luaL_newstate(); // lua_open();
std::cout << L << std::endl; // 0x0
}
Run Code Online (Sandbox Code Playgroud)
其他信息:从源内置在OSX 10.9(尝试都2.0.2和从GIT)与make和make install.使用编译器:
$ cc --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Run Code Online (Sandbox Code Playgroud)
(使用luajit命令行应用程序luajit工作正常,测试脚本可以正常执行.)
Col*_*Two 13
显然,x64 Mac应用程序需要特殊处理; 见http://luajit.org/install.html.
如果您在OSX上构建一个直接或间接与LuaJIT链接的64位应用程序,则需要将主可执行文件与这些标志链接:
Run Code Online (Sandbox Code Playgroud)-pagezero_size 10000 -image_base 100000000