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]

Apache module in C++


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




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