Re: [xml] wrong startElement called




Quoting Eric Haszlakiewicz <erh+libxml nimenees com>:

On Tue, Nov 09, 2004 at 04:17:13PM -0600, Robert G. Ristroph wrote:
    On the computer where the program crashes, the stack trace shows it
enters
the functions startElement which is in legacy.c at line 1397.  On the
computer
that works, it calls a startElement that is in my own code, a wrapper
around
libxml2.

    What might be causing the code to call one startElement() on one
machine and
a different one on the other ?  I have been struggling with this for some
time,
and I have already checked the versions and file sizes of all the .so
libraries
the program uses.

      Perhaps a bug in the dynamic linker?  Or maybe a difference in the order
that libraries are loaded.  Depending on whether your code or the libxml
code
is loaded first, the value stored in the PLT for the actual pointer to the
startElement function can be different.  I'm not quite sure what the
behavior
is supposed to be when you have two identically named global symbols (as
you seem to have)

I no longer have the problem.  Since I fixed it by installing a new version of
PHP from source, without changing version of xmllib or the way I used xmllib,
it seems likely that the cause is something like this.

    There is a "static xmlSAXHandler sax" which is defined in my code
which
holds a pointer to my startElement.

      How is your startElement function defined?  Is it static also?
The easiest way I can think of to fix your problem is just rename your
function.  Doesn't your linker spit out a warning when you link you
code?

The other solution, which should only be used if the libxml startElement
function should be allowed to be overridden, is to make it a weak symbol
alias in the library.

My startElement is not defined as a static, although I can see from comments in
my code that at one time it was.  This is something I'll have to look at
carefully and make sure we are doing it the right way, and I'll probably rename
it.

--Rob



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]