Re: [libxml++] [patch] Global initialization code



> > > I think so, with the global init doing nothing IF an environnement
> > > variable "LIBXMLPP_NO_STATIC_INIT" has been defined.
> >
> > This still requires recompilation and is therefore not ABI compatible,
> > IMHO.
>
> I think I disagree : the current global initialisation is done by
> Init::Init. We can, without breaking the ABI, change its behavior so it
> does nothing when a particular environment variable is set.
> We can add another class, let's say InitNG, which does what you suggested
> for Init.
> This way people who want to do manual initialisation can do it by setting
> this variable.

Sorry, missed the environment part while reading
as you wrote the french version ;-)

I would take the the environment variable as last option
because that's not very intuitive for the end user.
(f.e. program crashes because he/she forget to set it)

> Another way I just thought about is not to change Init::Init behavior, but
> adding both another init class and a free function (probably a static
> function of the new init class) which undo what Init have done and forces
> it's destructor not to do anything.
> The advantage is that the proper behavior of the program does not depend on
> a user intervention.

That would be an option, though it's still messy. Is there a garantuee
from the compiler in which order global objects are created?

Thomas




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