Invloking Ruby Methods From C

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 :wink:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs