# Confusion with extension modules

**URL:** <https://www.ruby-forum.com/t/confusion-with-extension-modules/55411>\
**Category:** Ruby\
**Created:** [December 31, 2005, 12:51pm UTC](https://www.ruby-forum.com/t/confusion-with-extension-modules/55411 "2005-12-31T12:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [December 31, 2005, 12:51pm UTC](https://www.ruby-forum.com/t/confusion-with-extension-modules/55411/1 "2005-12-31T12:51:33Z")

</div>

Hi,

I’m trying to write a very simple extension module using the example -  
[http://www.rubycentral.com/book/ext\_ruby.html](http://www.rubycentral.com/book/ext_ruby.html)

This is my version. The other methods are defined elsewhere. This  
compiles and loads into irb.

void Init\_dumphead()  
{  
dumphead = rb\_define\_class(“head”, rb\_cObject);  
rb\_define\_singleton\_method(dumphead, “new”, dh\_new, 0);  
rb\_define\_method(dumphead, “initialize”, dhead\_init, 0);  
}

The example refers directly to its version of “head”, but when I try to  
do this, I get a NameError on head. I’m also confused about what is  
being imported into the environment. Is dumphead (from Init\_dumphead)  
a module? Wouldn’t I have to refer to head using dumphead::head? If  
not, how would I make it a module?

thanks!

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 1, 2006, 9:31pm UTC](https://www.ruby-forum.com/t/confusion-with-extension-modules/55411/2 "2006-01-01T21:31:59Z")

</div>

I got it! It needs to be Head, not head.
