# Mixing C extension classes with ruby classes

**URL:** <https://www.ruby-forum.com/t/mixing-c-extension-classes-with-ruby-classes/69299>\
**Category:** Ruby\
**Created:** [September 20, 2006, 2:53am UTC](https://www.ruby-forum.com/t/mixing-c-extension-classes-with-ruby-classes/69299 "2006-09-20T02:53:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 20, 2006, 2:53am UTC](https://www.ruby-forum.com/t/mixing-c-extension-classes-with-ruby-classes/69299/1 "2006-09-20T02:53:33Z")

</div>

I have a C extension that defines a module and two classes in that  
module. I was looking at mongrel and mongrel also has a mongrel.rb  
file that defines the module and classes that are also defined in the  
C extension. However when I define the module in modulename.rb which  
also has a C extension that defines the module using rb\_define\_module,  
the definition in modulename.rb takes precedence, and C module/class  
definitions disappear.

I can post some code if needed, but maybe it’s just something simple I  
am missing.

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [September 20, 2006, 4:28pm UTC](https://www.ruby-forum.com/t/mixing-c-extension-classes-with-ruby-classes/69299/2 "2006-09-20T16:28:55Z")

</div>

Hi,

At Wed, 20 Sep 2006 09:51:34 +0900,  
snacktime wrote in [ruby-talk:215221]:

> I have a C extension that defines a module and two classes in that  
> module. I was looking at mongrel and mongrel also has a mongrel.rb  
> file that defines the module and classes that are also defined in the  
> C extension. However when I define the module in modulename.rb which  
> also has a C extension that defines the module using rb\_define\_module,  
> the definition in modulename.rb takes precedence, and C module/class  
> definitions disappear.

Do you require modulename.so in modulename.rb?
