httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahadevan R <Mahadeva...@sisl.co.in>
Subject [PATCH] Trivial patch for C++ modules (2.0.47)
Date Fri, 01 Aug 2003 03:44:09 GMT
Hello All,

While trying to write an Apache2 module in C++, I found that in the 
command table, AP_INIT_TAKE1 has to be used like this:

AP_INIT_TAKE1( "Directive", (cmd_func) drctv_handler, NULL, OR_ALL, 
"help string")

rather than just this:

AP_INIT_TAKE1( "Directive", drctv_handler, NULL, OR_ALL, "help string")

The compiler I'm using (MSVC++ 6.0) does not support "designated 
initializers". Hence
the compiler expects the function drctv_handler to have a signature of
"const char *(*cmd_func) ();" whereas it actually has a signature of
"const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);".

The situation can be easily solved (worked around?) by changing the 
definition of
AP_INIT_TAKE1 (and its friends) in http_config.h to:

# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
    { directive, (cmd_func) func, mconfig, where, TAKE1, help }

rather than just:

# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
    { directive, func, mconfig, where, TAKE1, help }

The attached patch (on 2.0.47) adds this cast into all the AP_* init 
#defines when
the compiler does not have designated initializers.

Please consider this patch for inclusion if you think it is useful.

Regards,
-Mahadevan.



Mime
View raw message