[gnutls-devel] eliminating gnutls_global_init

Nikos Mavrogiannopoulos nmav at gnutls.org
Sat Nov 30 16:15:48 CET 2013


On Sat, 2013-11-30 at 09:15 -0500, Daniel Kahn Gillmor wrote:
> On 11/29/2013 07:01 PM, Nikos Mavrogiannopoulos wrote:
> > The issues with having the initialization the constructor are
> > * It is not clear what to do on initialization error (e.g. when some I/O
> > fails)
> > * There will be different semantics in static libraries (that call no
> > constructors), which will still need to call gnutls_global_init and ELF
> > shared libraries that will not.
> > 
> > Any issues I've missed, or ideas?
> 
> how does this interact with tools that load gnutls via dlopen?  will
> they need to do anything special, or will dlopen take care of it?  what
> happens if a process dlopen()s the library twice? (e.g. via two separate
> modules in the PAM stack or something horrible like that)

It should be fine with dlopen(). Dlopen already had provision for the
_init and _fini functions and as far as I see from some googling it
seems to operate as expected with library constructors and destructors
(and it should as I guess they are implemented exactly the same way in
an ELF system).

regards,
Nikos





More information about the Gnutls-devel mailing list