From: Christophe de V. <cde...@al...> - 2005-06-17 08:41:57
|
Le Vendredi 17 Juin 2005 10:04, Thomas Jarosch a =E9crit=A0: > > > > 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 suggest= ed > > for Init. > > This way people who want to do manual initialisation can do it by setti= ng > > this variable. > > Sorry, missed the environment part while reading > as you wrote the french version ;-) Sorry :-) > 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) I don't think it's a good solution either. > > 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 stat= ic > > function of the new init class) which undo what Init have done and forc= es > > 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. A bit messy, but still better than the environment variable solution (it do= es=20 not rely on the user, so it's reliable), and not breaking the ABI. =46or now I don't see another way to achieve your goal not breaking the abi= and=20 being reliable. The only other way would need a specific compilation of libxml++ for your=20 project, which break the ABI. > Is there a garantuee=20 > from the compiler in which order global objects are created? Unfortunately no. That would be too easy :-) I know that with gcc we can be= =20 pretty sure the library global initialisation is done before the main progr= am=20 one. But we can't rely on it, as other compilers will cause problems. Regards, Christophe |