Invloking Ruby Methods From C

M

Mido Peace

Hi ,
I have a Stupid Question !!
I'd like to know how to invoke a Ruby methode from a C code .

Ok, you may tell me to use > rb_funcall !!
exactely that wht I want to do!!

but if I have My Ruby Script.rb SomWhere , with a function called euh..
Test() i.e ,
how can I tell the rb_funcall function to invoke the test method in the
Scipt.rb


Thx ;)
 
R

Roger Pack

I'd like to know how to invoke a Ruby methode from a C code .
Ok, you may tell me to use > rb_funcall !!
exactely that wht I want to do!!


typically you'll have a

(VALUE something)
then it's like

rb_funcall(something, rb_intern("method_name"), arg1, arg2)

where arg1 and arg2 are also ruby VALUE's

checkout the file README.EXT it might be helpful.

There's also an rb_eval_string("some ruby code")

or like
rb_eval_string("$abc.some_method")

if that helps.
-r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top