Constructor of external lib called too early
Dominik Vogt
vogt@linux.vnet.ibm.com
Mon Jul 29 12:55:00 GMT 2013
An external library - say, libfoo.{a,so} - defines a costructor
static void __attribute__ ((constructor 65535))
__foo_ctor (void)
{
const char *val;
val = getenv ("FOO_CFG");
...
}
and glibc is built and linked with -lfoo.
A program is linked against that the modified glibc. Now, when
the program is started, at the time __foo_ctor is called, the
environment is empty and FOO is never evaluated. I guess this
means that the constructor is called before the environment is
initialized.
Is there a way / what is the right way to have __foo_ctor called
_after_ the initialization of the environment? (Note that calling
the constructor from the executable instead of from glibc is not
an option.)
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
More information about the Libc-help
mailing list