You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joshua Rabinowitz <jo...@joshr.com> on 1999/05/21 19:48:38 UTC

C++ apache modules?

Dear Kind Apache Wizards:

Short question: Is there a clean way to compile and link apache 
modules in C++ into apache?  I've been able to do it by circumventing 
and modifying the normal apache configure/build process, but I'm 
wondering if there is a clean way to do it, like with options to 
./configure.  (After all, apache builds so nicely with normal C 
modules).

More details: (This should explain the issues)

The tricky parts (and they're not _that_ tricky) are that you have to 
create the proper 'extern "C"' callbacks for the apache handlers, AND 
get apache linked with the C++ linker instead of the C one.

I did this once as a proof of concept with apache 1.3.4, at that time I had to

a) wrap the apache headers that I needed to include in my C++ code within
   'extern "C" { .. }' blocks
b) create a libmyapachemodule.a library with the C-style
    apache handlers, and the c++ code they manipulate, (this was a
    little tricky), and
c) modify the apache makefile to link (but not compile) with g++ instead
    of gcc (can this be done with ./configure?)
d) arrange to link the libmyapachemodule.a library with apache
    (this part is easy!)

Now, (in apache 1.3.6), I notice that a) is already done (the apache 
headers already have the extern "C" stuff for C++ people), so it 
seems like people are writing C++ modules and it should be easier now.

Can anyone help shed light on this subject? Apologies if this is an 
FAQ (but I can't imagine it is!)

Thanks in advance,
Josh Rabinowitz
joshr@joshr.com