From: William Djaja Tjokroaminata Date: 2002-08-13T02:08:14+09:00 Subject: Re: Is There an Inverse of 'rb_define_method'? Well, I have not digged too deep into the Ruby C source code; however, to me the answer for the dynamic arguments should be from C variable number of arguments. I don't know the exact internal of Ruby, but to me, when parsing a Ruby script, I guess the "rb_define_method" is called with argc either equal to -1 or -2. Therefore, if I know that all the C functions are derived like this, there is no problem for me to call the C functions directly: if all are -1, then the function is of the form "func (int argc, VALUE *argc, VALUE self)", and if all are -2, then the function is of the form "func (VALUE self, VALUE args)". Regards, Bill ============================================================================ nobu.nokada@softhome.net wrote: > You know why it can't work: >> The problem is in my case, someone else (the user) will define the method >> in Ruby, and so I cannot record it when the method is defined. > And also, how can you know about the arguments? > If you will let users choose from functions you provide, you > can hold the pointer internally. Otherwise, it would be > impossible in general. C has no such dynamic feature. > -- > Nobu Nakada