Re: [libxml++] Global initialization code



> > > > The problem with the "static" class is that it gets executed
> > > > during library load time. This is why it breaks PHP.
> > >
> > > Do you need it not to be executed at all, or only once ?
> >
> > Only init once and reset after libxm++ code usage.
> > Something like:
> >
> > - libxml::init()
> > - XML manipultions via libxml++
> > - libxml::deinit()
>
> Well, to do libxml::init() and libxml::deinit(), you can simply control a
> Document::Init instance.
> The thing is that you need it not to be default initiated.
> Globally, this solution looks heavy to me, but I don't see a workaround.
>
> So it looks like a --disable-static-initialisation in the configure script
> would solve the issue.
>
> Any objection ?

Fine with me. Of course we have to add a destructor to the Document::Init
class and reset the callbacks. The Document::Init constructor needs an 
additional parameter (default: true) if it should call xmlCleanupParser()
during destruction.

I had another idea:
Would it be possible to create the global _init object via an include file?

#define LIBXMLPP_DISABLE_STATIC_INIT 1
#include <libxml++.h>

Multiple applications which use libxml++ could still
share the same binary library file.

Thomas




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