usefulness of UCLIBC_CTOR_DTOR ?

Rich Felker dalias at aerifal.cx
Sun Sep 18 14:04:48 UTC 2011


On Sat, Sep 17, 2011 at 11:55:02PM -0500, Rob Landley wrote:
> On 08/20/2011 10:24 PM, Rich Felker wrote:
> > On Sat, Aug 20, 2011 at 10:00:44PM -0400, Mike Frysinger wrote:
> >> On Friday, August 12, 2011 13:59:51 Rich Felker wrote:
> >>> On Fri, Aug 12, 2011 at 01:53:23PM -0400, Lennart Sorensen wrote:
> >>>> C libraries can have constructors and destructors too.
> >>>
> >>> No they cannot. Those may be "GNU C" libraries but they are not C
> >>> libraries.
> >>
> >> libraries written in C can have constructors and deconstructors too.  see the 
> >> init/fini gcc attributes.  this is part of the ELF spec and the language 
> >> (C/C++/...) is irrelevant.
> > 
> > Just because the ELF binary format makes it possible to do something
> > doesn't mean that's C. There's plenty you can do with ELF making an
> > ELF file by hand that would be impossible with any C compiler or even
> > a GNU C compiler. Ctors/dtors are part of ELF so it can support C++.
> 
> atexit() predates c++.

Has nothing to do with ctors/dtors. Running atexit functions is part
of the exit() library call (implicitly called after main returns, if
not explicitly).

Rich


More information about the uClibc mailing list