[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: segfault with dynamic lib and lua, depending of function name in the lib !
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 22 Dec 2010 13:43:04 -0200
> I got the same behaviour than before: segfault (or bus error) if
> "lua_step" call the inside "step" function. If i rename "step" to "tep",
> no problems with Lua.
It seems that gcc is using an internal "step" function. See #1 below.
#0 __regexec (preg=0x40, string=0x80710c8 "./simple.so", nmatch=1,
pmatch=0xbffff4b8, eflags=2) at regexec.c:232
#1 0xb7ea3562 in __step (string=0x80710c8 "./simple.so",
expbuf=0x3c <Address 0x3c out of bounds>) at regexp.c:45
#2 0xb7fdd616 in lua_step (L=0x806c008) at simple.c:31
Making your step static fixes this. In general, it's a very good idea
to use as many static functions as possible. (So, make init static as well.)