[TRE-general] Weird bug
skaller
skaller at users.sourceforge.net
Mon May 15 08:03:28 EEST 2006
On Mon, 2006-05-15 at 14:36 +1000, skaller wrote:
> I am getting a weird bug terminating Felix.
> This looks like tre is corrupting memory.
Argg. Sorry. It's linking the wrong function.
skaller at rosella:/work/felix/flx$ g++ ./aa.o ./rtl/flx_run_static.o
-Lrtl -lfaio_static -ldemux_static -lflx_static -o ./aa -lpthread
-lflx_async_static -lfaio_static -ldemux_static -lflx_pthread_static
-lflx_static
Tre isn't even linked in. This is very bad, its the stupid
GNU system at fault, thinking they can set private standards.
[The C library should have ONLY functions defined by C in it,
everything else should have to be explicitly linked in]
Now watch:
skaller at rosella:/work/felix/flx$ g
++ ./aa.o /usr/local/lib/libtre.a ./rtl/flx_run_static.o -Lrtl
-lfaio_static -ldemux_static -lflx_static -o ./aa -lpthread
-lflx_async_static -lfaio_static -ldemux_static -lflx_pthread_static
-lflx_static
skaller at rosella:/work/felix/flx$ ./aa
Done tre compile
Compiled
Finished
Now it works.
Ville -- can we have the functions with two names?
I want to call tre_regcomp etc to be SURE I'm not
using the gnu version. The existing names need to stay
for Posix compatibility. I'm not sure how to do this
other than with a forwarding function (possibly inline).
I don't think it can be done with macros. It has to work
no matter how the client compiled the TRE library (so
please don't make it a configure option, I have to use
the version of tre the client has installed).
The way to do this, I think, is that the main tre library
should have functions called tre_* only.
An additional wrapper library is provided for posix
compatibility and can be used for Posix compliance and
to disable linking of the GNU versions.
This does cost an extra 'indirection' in the call,
I'm not sure that is significant -- if you really want
performance, call tre_* functions: you know you have
them because you're deliberately using TRE for performance.
However it does slow down plugin replacement code.
Thoughts, not sure best way. No problem with the Felix
version of tre since it's compiled as C++, this problem
cannot arise with C++ (because the type of the arguments
differs and in any case I use namespaces).
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
More information about the TRE-general
mailing list