Re: Problems starting Apache 2.2 with mod_ruby

Dan Cross <[email protected]> Tue, 10 Jan 2006 07:55:23 -0500
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
On Tue, Jan 10, 2006 at 08:37:53PM +0900, Michael Sullivan wrote:
> #ifdef APACHE2
> 	apr_new-function_call(....);
> #else
> 	ap_old_function(...);
> #endif

I don't recommend doing this.  It's a good way to introduce errors.  A
better approach is to create an intermediate interface that you program
to, and then provide concrete implementations of that for both old and
new APR functions, and link in the apporpriate versions at the end.  E.g.,
instead if the above, have:

	stub_apr_call(...);	/* Hopefully with a better name */

And then in oldap.c:

whatever *
stub_apr_call(...)
{
	return ap_old_function(...);
}

While in newapr.c:

whatever *
stub_apr_call(...)
{
	return apr_new_function(...);
}

In general, conditional compilation has been a fruitful source of errors,
and something like this will be easier to debug.

	- Dan C.