manipulating a symbol in C

  • Thread starter Elias Athanasopoulos
  • Start date
E

Elias Athanasopoulos

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,
 
E

Elias Athanasopoulos

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...

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

Regards,
 

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
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top