[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

confusion with extension modules

goldfita

12/29/2005 5:53:00 PM

Hi,

I'm trying to write a very simple extension module using the example -
http://www.rubycentral.com/book/ext...

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!

1 Answer

goldfita

12/30/2005 4:57:00 AM

0

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