stillflame
Programmer
- Jan 12, 2001
- 416
well, this is probly more than any of you have tried to do with ruby yet, but i'll ask anyway.
i'm working on a c extension for ruby (doing a ruby version of perl's Lingua::LinkParser, for anyone who cares), and i'm unsure about how to use the api fuctions 'funcall' and 'rb_intern'. i know i can just use 'rb_eval_string' and be done with it, but i wanted to make this a little bit more efficient.
the question:
you call funcall like this -
funcall(object, method_id, argc, ...)
to get the method_id, you use rb_intern like this -
rb_intern("method_name"
but, since there are many different objects with methods that have the same name, do you have to include the class name with the method name like: "Class.method", or what?
i don't know, and i'm still a little scared to even compile any of my extension code.. i am working on a test extension to try and figure out how it works, so if you don't know the answer immediately after you're finished reading this (or before then), don't do ANY work to try and figure it out. i'm just asking this to save myself the work of writing out the (admittedly very simple) tests...
if noone else answers this before i figure it out, i'll post my answer.
thanks "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
i'm working on a c extension for ruby (doing a ruby version of perl's Lingua::LinkParser, for anyone who cares), and i'm unsure about how to use the api fuctions 'funcall' and 'rb_intern'. i know i can just use 'rb_eval_string' and be done with it, but i wanted to make this a little bit more efficient.
the question:
you call funcall like this -
funcall(object, method_id, argc, ...)
to get the method_id, you use rb_intern like this -
rb_intern("method_name"
but, since there are many different objects with methods that have the same name, do you have to include the class name with the method name like: "Class.method", or what?
i don't know, and i'm still a little scared to even compile any of my extension code.. i am working on a test extension to try and figure out how it works, so if you don't know the answer immediately after you're finished reading this (or before then), don't do ANY work to try and figure it out. i'm just asking this to save myself the work of writing out the (admittedly very simple) tests...
if noone else answers this before i figure it out, i'll post my answer.
thanks "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."