Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 81884 invoked from network); 12 Oct 2006 13:40:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Oct 2006 13:40:44 -0000 Received: (qmail 99348 invoked by uid 500); 12 Oct 2006 13:40:44 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 99331 invoked by uid 500); 12 Oct 2006 13:40:44 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 99322 invoked by uid 99); 12 Oct 2006 13:40:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 06:40:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of James.Kratzer@ngc.com designates 208.20.220.55 as permitted sender) Received: from [208.20.220.55] (HELO xmrt0101.northgrum.com) (208.20.220.55) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Oct 2006 06:40:42 -0700 Received: from XBHT0001.northgrum.com ([132.228.189.53]) by xmrt0101.northgrum.com with InterScan Message Security Suite; Thu, 12 Oct 2006 06:39:30 -0700 Received: from xcgoh901.northgrum.com ([167.225.22.33]) by XBHT0001.northgrum.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Thu, 12 Oct 2006 07:40:20 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message Subject: RE: Developing C++ modules with apache 1.3.34 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Date: Thu, 12 Oct 2006 09:40:19 -0400 Message-ID: <85A664F2F3F2D1409EE003C7D3D52EE43C3D0D@xcgoh901.northgrum.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Developing C++ modules with apache 1.3.34 Thread-Index: AcbtyphycfDfS1t7RsqIYy5sXtDq9AAOLWUg From: "Kratzer, James \(Xetron\)" To: X-OriginalArrivalTime: 12 Oct 2006 13:40:20.0665 (UTC) FILETIME=[F607B290:01C6EE03] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, Here is what I'm doing with Apache 2.0. I use autoconf and libtool to create my makefiles and to build my apache modules. I then put all of your C++ functions is a separate source file having a cpp extension and I wrap the c++ functions with extern "C" declarations. I then call the c++ functions from the C module code. Works great. James Kratzer =20 -----Original Message----- From: Manish Chakravarty [mailto:manishchaks@gmail.com]=20 Sent: Thursday, October 12, 2006 2:49 AM To: modules-dev@httpd.apache.org Subject: Developing C++ modules with apache 1.3.34 Hi All, I am a newbie to Apache development. I am trying to develop a module for apache 1.3.34 in C++. I really need to link with some C++ libs and use C++ headers for this project. 1) How do i go about it ? Do i follow the standard Makefile approach as outlined in the book "Writing Apache Modules with Perl and C" ? 2) The sample skeleton code (mixed C/C++) is given below. Would someone be kind enough to go through and tell me if my approach is OK? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3DExample code = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= #include "apache/httpd.h" #include "http_config.h" #include "http_core.h" #include "http_log.h" #include "http_protocol.h" #undef strtoul //will the next line work as intended? extern "C" module MODULE_VAR_EXPORT clickout_module; static void co_mod_init(server_rec *s, pool *p) { //some module initialization stuff } static int co_handler(request_rec *r) { const char* hostname; r->content_type =3D "text/html"; ap_send_http_header(r); hostname =3D ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME); ap_rputs ("Some text"); return OK; } static handler_rec co_handlers[] =3D { {"some-hander", some_handler}, {NULL} }; void co_proc_init(server_rec* s, pool* p) { // some c++ initialization functions here. } extern "C" { // is this extern useful here? module MODULE_VAR_EXPORT clickout_module =3D { STANDARD_MODULE_STUFF, co_mod_init, /** module initializer */ NULL, /** per-directory config creator */ NULL, /** dir config merger */ NULL, /** server config creator */ NULL, /** server config merger */ NULL, /** command table */ co_handlers, /** [9] content handlers */ NULL, /** [2] URI-to-filename translation */ NULL, /** [5] check/validate user_id */ NULL, /** [6] check user_id is valid *here* */ NULL, /** [4] check access by host address */ NULL, /** [7] MIME type checker/setter */ NULL, /** [8] fixups */ NULL, /** [10] logger */ NULL, /** [3] header parser */ co_proc_init, /** process initialization */ NULL, /** process exit/cleanup */ NULL /** [1] post read_request handling */ }; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3DEnd example code = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thanks in advance.!! -- Warm Regards, Manish Chakravarty ---- Consultant Software Developer PH: +919886702500 http://manishchaks.net ---