You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Farheen Jafri <ja...@yahoo.com> on 2003/08/15 14:51:50 UTC

C++ module compile with apxs

Hello,

I create C++ module because i ve to use STL in it.
When i compile it with apxs, 

apxs -L /usr/include/c++/ -L
/usr/include/c++/3.2/i386-redhat-linux/ -I/usr/lib/ -i
-c mod_replace.cpp


it create .so but not complete because restarting
apache gives "undefined sysmbol: replace_module"
error.

#httpd.conf 

LoadModule replace_module modules/mod_replace.so

where replace_module is the name of module defined in
mod_replace.cpp

plz tell me any method to compile cpp module which
uses STL by apxs. Any help will be appreciated!

Regards,
Farheen

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Re: C++ module compile with apxs

Posted by "John K. Sterling" <jo...@sterls.com>.
On Friday, August 15, 2003, at 08:51 AM, Farheen Jafri wrote:
> apxs -L /usr/include/c++/ -L
> /usr/include/c++/3.2/i386-redhat-linux/ -I/usr/lib/ -i
> -c mod_replace.cpp

Hi Farheen -

1) what version of apache?
2) are any of your symbols defined in the so (use 'nm' and grep for 
them)?
3) is your code defining the c portions in an 'extern "C"' block? 
(maybe you could send a snippet)
4) what does your module definition look like.

sterling


Re: C++ module compile with apxs

Posted by rscheckelhoff <rs...@yahoo.com>.
Hi:

I have been having some of the same problems with the apxs script.  I 
think that because apache 1.3 is built with c (not c++), apxs is 
defaulting to the standard c lib for the build.  Additionally, I think 
that it just ignores your apxs switch to use the stdc++ library.  I 
guess we could rewrite the perl script!

But anyway, I have been using a work-around.  I just create two 
projects, (a "skinny" one for a standard c-apxs build mother-module, and 
a "fat" C++ library project for my back-end code).  I use apxs to 
compile the skinny module, and build the C++ separately as a shared 
library. Then I just call the C++ library "wrapper" routines from within 
the apxs code using dlopen/dlfunc/dlsym/etc.  (Since my "back-end" 
library only returns an answer or html page, etc., the wrapper code is 
not much of a nuisance.)

I wonder if Apache 2.0 apxs script better accomodates C++ ?

 -rleesBSD


--- In new-httpd@yahoogroups.com, Farheen Jafri <ja...@y...> wrote:
> Hello,
> 
> I create C++ module because i ve to use STL in it.
> When i compile it with apxs, 
> 
> apxs -L /usr/include/c++/ -L
> /usr/include/c++/3.2/i386-redhat-linux/ -I/usr/lib/ -i
> -c mod_replace.cpp
> 
> 
> it create .so but not complete because restarting
> apache gives "undefined sysmbol: replace_module"
> error.
> 
> #httpd.conf 
> 
> LoadModule replace_module modules/mod_replace.so
> 
> where replace_module is the name of module defined in
> mod_replace.cpp
> 
> plz tell me any method to compile cpp module which
> uses STL by apxs. Any help will be appreciated!
> 
> Regards,
> Farheen
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com