From: Elias Athanasopoulos Date: 2004-09-12T22:47:27+09:00 Subject: Re: Extending ruby with crypto++ On Wed, Sep 08, 2004 at 05:25:07PM +0900, Dominik Werder wrote: > bash-2.05b$ g++ -c cRubyTest.c > cRubyTest.c: In function `void Init_cRubyTest()': > cRubyTest.c:56: error: invalid conversion from `VALUE (*)(long > unsigned int)' > to `VALUE (*)(...)' This macro is taken from SWIG: #ifdef __cplusplus # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ # define VALUEFUNC(f) ((VALUE (*)()) f) # define VOIDFUNC(f) ((void (*)()) f) # else # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ # define VALUEFUNC(f) ((VALUE (*)()) f) # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) # else /* These definitions should work for Ruby 1.7 */ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) # endif # endif #else # define VALUEFUNC(f) (f) # define VOIDFUNC(f) (f) #endif It's pretty safe to use it in your extension. You should use this macro in rb_define_method() and similar functions: /* Define method. */ rb_define_method(klass, name, VALUEFUNC(f), -1); Regards, -- University of Athens I bet the human brain Physics Department is a kludge --Marvin Minsky