You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Somostetoi Kilato <so...@googlemail.com> on 2013/05/01 14:21:32 UTC

Using APR based C++ classes in Apache2 module

Hallo,

I have a small web page generator library, written in C++ and I am
rewriting it to use APR. More, I would like to create an Apache2 module
which will use this generator. But I have no idea how to integrate it into
Apache2.

Maybe somebody is so kind to guide me in this process and he/she can
provide me some examples. Thank you in advance.

Best regards,
SK

Re: Using APR based C++ classes in Apache2 module

Posted by Ralf Mattes <rm...@seid-online.de>.
On Thu, May 02, 2013 at 10:07:39AM +0200, Graf L?szl? wrote:
> 
> Hi Joe,
> 
> I appreciate your response. I did a search on the net and I found
> this, two parts, How-To:
> 
> http://www.codeproject.com/Articles/491909/Apache-2-x-Modules-In-Cplusplus-Part-1
> 
> http://www.codeproject.com/Articles/492398/Apache-2-x-Modules-In-Cplusplus-Part-2
> 
> I followed all the steps but at the end, when I restarted the Apache
> server, I got this error:
> 
> httpd: Syntax error on line 521 of /home/sk/apache2/conf/httpd.conf:
> Cannot load modules/mod_foo.so into server:
> /home/sk/indian/modules/mod_foo.so: undefined symbol:
> foo_register_config_ptr
> 
> I links to the header files into the Apache2's include folder and a

No need to link the header files - what for?

> link to the SO into the Apache2's modules folder.

Yes, and obviously it's found by the server (otherwise it wouldn't complain
about it, would it? :-)

> 
> Am I missing something here?

No you, but your linker. Where is 'foo_register_config_ptr' defined?
And before any further investigation: you don't by chance try to compile 
with a C++ compiler? If so, You know about name mangling? If not, it's time
for some C vs. C++ readup ....


 HTH Ralf Mattes
 
> Best regards,
> SK

Re: Using APR based C++ classes in Apache2 module

Posted by Graf László <gr...@datatrans.hu>.

2013-05-01 15:48 keltezéssel, Joe Lewis írta:
> On 05/01/2013 06:21 AM, Somostetoi Kilato wrote:
>> Hallo,
>>
>> I have a small web page generator library, written in C++ and I am
>> rewriting it to use APR. More, I would like to create an Apache2 module
>> which will use this generator. But I have no idea how to integrate it
>> into
>> Apache2.
>>
>> Maybe somebody is so kind to guide me in this process and he/she can
>> provide me some examples. Thank you in advance.
>>
>> Best regards,
>> SK
>>
> If you have the Apache HTTP server source code, there are a number of
> examples.  If you don't have access, I'd suggest procuring a copy of
> Nick Kew's book about writing HTTPD modules for Apache.
>
> If you cannot afford a book you can always use the documentation for
> getting started (virtually any popular search engine would be able to
> guide you to some things, for example, typing in "apache module example
> c++").
>
> Hopefully, this will help.  If you have specific questions that you
> cannot find answers to in the history of this list, we'd love to help.
>
> Thanks,
> Joe
>

Hi Joe,

I appreciate your response. I did a search on the net and I found this, 
two parts, How-To:

http://www.codeproject.com/Articles/491909/Apache-2-x-Modules-In-Cplusplus-Part-1

http://www.codeproject.com/Articles/492398/Apache-2-x-Modules-In-Cplusplus-Part-2

I followed all the steps but at the end, when I restarted the Apache 
server, I got this error:

httpd: Syntax error on line 521 of /home/sk/apache2/conf/httpd.conf: 
Cannot load modules/mod_foo.so into server: 
/home/sk/indian/modules/mod_foo.so: undefined symbol: 
foo_register_config_ptr

I links to the header files into the Apache2's include folder and a link 
to the SO into the Apache2's modules folder.

Am I missing something here?

Best regards,
SK

Re: Using APR based C++ classes in Apache2 module

Posted by Joe Lewis <jo...@joe-lewis.com>.
On 05/01/2013 06:21 AM, Somostetoi Kilato wrote:
> Hallo,
>
> I have a small web page generator library, written in C++ and I am
> rewriting it to use APR. More, I would like to create an Apache2 module
> which will use this generator. But I have no idea how to integrate it into
> Apache2.
>
> Maybe somebody is so kind to guide me in this process and he/she can
> provide me some examples. Thank you in advance.
>
> Best regards,
> SK
>
If you have the Apache HTTP server source code, there are a number of 
examples.  If you don't have access, I'd suggest procuring a copy of 
Nick Kew's book about writing HTTPD modules for Apache.

If you cannot afford a book you can always use the documentation for 
getting started (virtually any popular search engine would be able to 
guide you to some things, for example, typing in "apache module example 
c++").

Hopefully, this will help.  If you have specific questions that you 
cannot find answers to in the history of this list, we'd love to help.

Thanks,
Joe