Jeremy Henty wrote:
> In article <200505310607.j4V67vTW003371 / moulon.inra.fr>, ts wrote:
> 
>>>>>>>"J" == Jeremy Henty <jeremy / chaos.org.uk> writes:
>>
>>J> * If I have to #ifdef a macro to support both 1.6.x and 1.8.x , what's
>>J>   a clean way to do it?  
>>
>>svg% /usr/bin/ruby -vrmkmf -e 'have_func("rb_block_proc")'
> 
> 
> OK, so if I add 'have_func("rb_block_proc")' to extconf.rb and:
> 
> #ifndef HAVE_RB_BLOCK_PROC
> #define rb_block_proc rb_f_lambda
> #endif
> 
> to the header file, I can globally replace rb_f_lambda by
> rb_block_proc everywhere else and the result will build under 1.6.x ?
> 
> I don't have time to test this before I go to work but I will this
> evening (unless someone points out some pitfall I've missed).
> 

For the sake of the people who will maintain this code after you've 
moved on, I suggest you pick a 3rd, all-caps, symbol to use as the 
preprocessor symbol:

#if defined(HAVE_RB_BLOCK_PROC)
#define BLOCK_PROC rb_block_proc
#else
#define BLOCK_PROC rb_f_lambda
#endif

Since it's very common to make preprocessor symbols all-caps (and very 
uncommon for function names to be all-caps) when the next maintainer 
starts looking at your source code, the BLOCK_PROC symbol will prompt 
him/her to go look for its definition in a header file.