Manipulating a symbol in C


(Elias Athanasopoulos) #1

Hello!

Consider I have in Ruby:

def foo(meth)
method(meth).call
end

foo :puts

How can I do this in C? I tried like this:

rb_funcall(self, rb_to_id(meth), 0);

with TObject#puts and I got a segfault, which is a sign that
I am unaware of fundamental things in Ruby internals…

Any hints?

Regards,

···


University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky


(Elias Athanasopoulos) #2

Braindamage. It works. Lots of coding today, less coffee than
it is required. Sorry for the noise.

Regards,

···

On Wed, Feb 11, 2004 at 03:26:56AM +0900, Elias Athanasopoulos wrote:

Hello!

Consider I have in Ruby:

def foo(meth)
method(meth).call
end

foo :puts

How can I do this in C? I tried like this:

rb_funcall(self, rb_to_id(meth), 0);

with TObject#puts and I got a segfault, which is a sign that
I am unaware of fundamental things in Ruby internals…


University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky