This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Apache module in C++


On Jun 22, 2001, Jes Rahbek Klinke <jrk@sysorb.com> wrote:

> My problem is, that contructors and destructors of global variables is
> not called, as the main apache executable is not aware of C++.

> Does anyone know if collect2 can do this, and how?

Presumably, linking your C++ shared library using g++, which already
uses collect2, should get initializers to run when your module is
dlopen()ed, and global destructors to run when it's dlclose()d (but
beware static variables in function scope; these are scheduled for
destruction with atexit(), so they'll only run when the whole
application terminates, which may be long after the module is
dlclose()d)

If a module created with g++ won't have initializers run at dlopen()
time, odds are that the OS you're running doesn't support this
feature.  Fortunately, such OSs are rare these days.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]