This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Apache module in C++
- To: gcc at gcc dot gnu dot org
- Subject: Apache module in C++
- From: Jes Rahbek Klinke <jrk at sysorb dot com>
- Date: Fri, 22 Jun 2001 14:47:04 +0200
- Organization: SysOrb
Hello,
My problem resembles the one above concerning mixing C++ and C
libraries.
I would like to write a dynamic loadable module for apache in C++. I
thought it would be possible by linking static with the C++ libraries.
This also seemed to work al right, as apache would load load the module
without complaining about unresolved referenced to the C++ library
entries.
My problem is, that contructors and destructors of global variables is
not called, as the main apache executable is not aware of C++.
I heard of the utility called collect2 which can be used to collect
global constructors and destructors, and somehow insert calls for them
before/after the main() function. The thing I would like was, if
collect2 could generate one function, which calls every global
constructor, that I could manually call from the apache module init
function.
Does anyone know if collect2 can do this, and how?
You may say, that I could just refrain from using global variables
having constructors, and instead have a global pointer to them, thereby
avoiding the problem. But it seems like some parts of the standard C++
library makes use of such gloabal variables.
Thanks in advance
Jes Klinke