From: William Fulton Date: 2013-04-04T01:59:01+09:00 Subject: C API version / functionality detection What is a reliable and future proof way of detecting available functions in the Ruby C API? In particular I would like to use rb_obj_is_proc, rb_proc_arity etc, which both seem to be only in 1.9 and later. I've read that there is no version macro to use, so one has to use some other macro to determine what is available. What should one be using? The best I can see is to use something like T_COMPLEX which was introduced in 1.9, however, this has nothing to do with the Proc enhancements: #if defined(T_COMPLEX) // T_COMPLEX introduced in 1.9 if ( rb_obj_is_proc( obj ) == Qtrue ) // Only available in 1.9 #else if ( rb_respond_to( obj, rb_intern("call") ) == Qtrue ) // Does not work in 1.9 and later #endif Clearly I need to seemlessly support different versions from C. -- Posted via http://www.ruby-forum.com/.