diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg index bf46dc88d..d55d49882 100644 --- a/Lib/ruby/rubyhead.swg +++ b/Lib/ruby/rubyhead.swg @@ -96,5 +96,14 @@ #endif +// For ruby1.8.4 and earlier. +#ifndef RUBY_INIT_STACK + extern void Init_stack(VALUE* addr); +# define RUBY_INIT_STACK \ + VALUE variable_in_this_stack_frame; \ + Init_stack(&variable_in_this_stack_frame); +#endif + + /* Global module used to keep some internal SWIG stuff */ static VALUE _mSWIG = Qnil; diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index cce2fa9f6..39e30a281 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -84,20 +84,13 @@ static VALUE swig_runtime_data_type_pointer = Qnil; /* If your swig extension is to be run within an embedded ruby and has - director callbacks, you should set RUBY_EMBEDDED. This will reset - ruby's stack frame on each entry point from the main program the first - time a virtual director function is invoked (in a non-recursive way). - If this is not done, you run the risk of trashing the stack. + director callbacks, you should set -DRUBY_EMBEDDED during compilation. + This will reset ruby's stack frame on each entry point from the main + program the first time a virtual director function is invoked (in a + non-recursive way). + If this is not done, you run the risk of Ruby trashing the stack. */ -#ifndef RUBY_INIT_STACK - extern void Init_stack(VALUE* addr); -# define RUBY_INIT_STACK \ - VALUE variable_in_this_stack_frame; \ - Init_stack(&variable_in_this_stack_frame); -#endif - - #ifdef RUBY_EMBEDDED # define SWIG_INIT_STACK \