# Rb\_funcall

**URL:** <https://rubytalk.org/t/rb-funcall/57249>\
**Category:** ruby-talk\
**Created:** [3 February 2010 08:59 UTC](https://rubytalk.org/t/rb-funcall/57249 "2010-02-03T08:59:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mido\_Peace](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@Mido\_Peace](https://rubytalk.org/u/Mido_Peace)\
**Post date:** [3 February 2010 08:59 UTC](https://rubytalk.org/t/rb-funcall/57249/1 "2010-02-03T08:59:36Z")

</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()  
&nbsp;&nbsp;&nbsp;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 ()  
&nbsp;&nbsp;super()  
&nbsp;&nbsp;puts "alb alb alb"  
end  
end

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

Can SomeOne Help ??

Thx 😉

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Mido\_Peace](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@Mido\_Peace](https://rubytalk.org/u/Mido_Peace)\
**Post date:** [3 February 2010 09:46 UTC](https://rubytalk.org/t/rb-funcall/57249/2 "2010-02-03T09:46:50Z")

</div>

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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
