# Rb\_funcall

**URL:** <https://www.ruby-forum.com/t/rb-funcall/182823>\
**Category:** Ruby\
**Created:** [February 3, 2010, 9:59am UTC](https://www.ruby-forum.com/t/rb-funcall/182823 "2010-02-03T09:59:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![coldpeace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f4b2a3/32.png) [@coldpeace](https://www.ruby-forum.com/u/coldpeace)\
**Post date:** [February 3, 2010, 9:59am UTC](https://www.ruby-forum.com/t/rb-funcall/182823/1 "2010-02-03T09:59:34Z")

</div>

Hi ,

we know that rb\_funcall , is used to call some Ruby Methods from the C  
code ,  
actualy , This is what I tried , but in my case , it doesnt seem to work

my case is , that I should call a Ruby Method from a Ruby Class that  
inherite from another Class.

with a Simple Ruby Class

class MyClass {  
def initialize()  
puts “bla bla bla”  
end  
end

rb\_funcall3(rb\_const\_get(rb\_cObject, rb\_intern(“MyClass”)),  
rb\_intern(“new”), 0, 0); // Works Good !!

But If I have

class MyClass \< AnotherClass

def intialize ()  
super()  
puts “alb alb alb”  
end  
end

the rb\_funcall Stucks !!  
ruby: allocator undefined for MyClass (TypeError)

Can SomeOne Help ??

Thx 😉

---

<div class="post-metadata">

**Author:** ![coldpeace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f4b2a3/32.png) [@coldpeace](https://www.ruby-forum.com/u/coldpeace)\
**Post date:** [February 3, 2010, 10:46am UTC](https://www.ruby-forum.com/t/rb-funcall/182823/2 "2010-02-03T10:46:44Z")

</div>

Oups … It’s Ok !!  
I was Just inheritin’ from The Thread Class and I forgot To initialize  
the SuperClass … So ./Clear  
😉
