From: "Daniel Schömer" Date: 2008-11-12T02:17:28+09:00 Subject: Re: testing for ruby 1.9 in extension code Alex Fenton wrote: > In C extension code, what's the canonical way to test whether the ruby > being compiled against is 1.8 or 1.9? > [...] > But this seems accidental. However I didn't find a RUBY_VERSION constant > in the headers anywhere. > [...] Have you looked at version.h? # head -n12 ruby-1.9-svn/version.h #define RUBY_VERSION "1.9.0" #define RUBY_RELEASE_DATE "2008-11-10" #define RUBY_VERSION_CODE 190 #define RUBY_RELEASE_CODE 20081110 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 11 #define RUBY_RELEASE_DAY 10 Regards, Daniel