[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua calls C : ok with Lua, hangs with LuaJIT
- From: jseb <gmane2010@...>
- Date: Mon, 13 Dec 2010 22:05:16 +0100
This test runs without error when using Lua legacy interpreter.
When using LuaJIT-2 (for x64 arch), it hangs at the end.
I suspect an "oops" in my code.
What do you think about this ?
Thank you.
====== lua code =========
#!/usr/bin/env lua
c_print_string = package.loadlib ("./malib.so","print_string")
c_print_string("i am lua string")
====== C code =========
#include <stdio.h>
#include <lua.h>
#include "lauxlib.h"
void print_string(lua_State *L)
{
const char *str = luaL_checkstring (L, 1);
printf("chaine Lua: [ %s ]\n",str);
}
========= result with lua interpreter ==========
$ lua acces_lib.lua
chaine Lua: [ i am lua string ]
========= result with LuaJIT interpreter ========
$ luajit2 acces_lib.lua
chaine Lua: [ i am lua string ]
Erreur de segmentation
I got segfault at the end ! Memory leak ?