Hi.
I'm writing my first module in c++ for apache and this is its code in mod_cpp.cpp file:
module AP_MODULE_DECLARE_DATA cpp_module =
{
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
register_hooks
};
static int handle(request_rec *r){
ap_set_content_type(r, "text/html");
ap_rprintf(r, r->filename);
}
static void register_hooks(apr_pool_t *pool)
{
/* Create a hook in the request handler, so we get called when a request arrives */
ap_hook_handler(handle, NULL, NULL, APR_HOOK_LAST);
}
However when I try to compile it install and actibvate by apxs -i -a -c mod_cpp.cpp I get:
[oneat@localhost ~]$ sudo apxs -iac mod_cpp.cpp
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now -o mod_cpp.la -rpath /usr/lib/httpd/modules -module -avoid-version mod_cpp.cpp
apxs:Error: Sorry, cannot determine bootstrap symbol name.
apxs:Error: Please specify one with option `-n'.
then I tried
sudo apxs -iac -n cpp mod_cpp.cpp
and everything went well, but when I try to start apache I get:
httpd: Syntax error on line 55 of /etc/httpd/conf/httpd.conf: Can't locate API module structure `cpp_module' in file /usr/lib/httpd/modules/mod_cpp.so: /usr/lib/httpd/modules/mod_cpp.so: undefined symbol: cpp_module
Any ideas why?
Regards, Peter.