You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ravi/ravi-tests/dmrc_testllvm.lua

20 lines
342 B

local testfunc = [[
struct lua_State;
extern int puts(const char *);
extern int TestFunc(struct lua_State *L);
int TestFunc(struct lua_State *L)
{
puts("hello world!\n");
return 0;
}
]]
local ctx = llvm.context()
local m = ctx:newmodule()
m:compileC(testfunc)
local f = m:getfunction("TestFunc")
local callable = f:compile()
callable()