Prepare new Release
[tcc4lua.git] / test / test2.lua
blob9ba0d230fd254e5bb0e246c157828b4990b92e00
1 print "luatcc working compilation test:"
2 print "--------------------------------"
4 local luatcc = require 'tcc'
5 local context = luatcc.new()
7 context:add_include_path('/usr/include/lua5.1')
8 context:define_symbol('STR','"Hello World!"')
9 context:compile([[
10 #include <lua.h>
11 int foo(lua_State* L)
13 lua_pushstring(L, STR);
14 return 1;
16 ]])
17 context:undefine_symbol('STR')
18 context:relocate()
19 local foo = context:get_symbol("foo")
20 print(foo())