Re: Re: writing my first own module - can't determine bootstrap symbol name; undefined API module structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 2, 2013 at 12:22 PM, oneat <oneat@xxxxx> wrote:
> 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.
>
>
>>>>>>>>>>>>>>>
>Are you sure you're declaring anything you expect apache to be able to
>find as extern C?

..>Try adding this line in your cpp file, before you declare cpp_module:

>extern module cpp_module;

>Cheers

>Tom

I used extern "C" without any success (bracing whole code or typed extern before module). I tried changing name of file from mod_cpp.cpp to mod_cpp.c but the it even doesn't compile:
mod_cpp.c:1:1: error: unknown type name 'module'
mod_cpp.c:1:32: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cpp_module'
mod_cpp.c:12:19: error: unknown type name 'request_rec'
mod_cpp.c:19:28: error: unknown type name 'apr_pool_t'




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux