This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Apache module in C++
- To: Jes Rahbek Klinke <jrk at sysorb dot com>
- Subject: Re: Apache module in C++
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 27 Jul 2001 05:17:27 -0300
- Cc: gcc at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <3B333E48.18AEDC98@sysorb.com>
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