confusion with extension modules

Discussion in 'Ruby' started by goldfita@signalsguru.net, Dec 29, 2005.

  1. Guest

    Hi,

    I'm trying to write a very simple extension module using the example -
    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!
     
    , Dec 29, 2005
    #1
    1. Advertising

  2. Guest

    I got it! It needs to be Head, not head.
     
    , Dec 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    3
    Views:
    907
    Tim Daneliuk
    Nov 8, 2003
  2. MrBlueSky

    Modules... paths... newbie confusion

    MrBlueSky, Aug 21, 2006, in forum: Python
    Replies:
    9
    Views:
    356
    Steve Holden
    Aug 25, 2006
  3. Replies:
    2
    Views:
    260
    Steve Holden
    Nov 10, 2006
  4. r0g
    Replies:
    7
    Views:
    267
  5. Old Echo
    Replies:
    8
    Views:
    121
    Robert Klemme
    Jun 14, 2008
Loading...

Share This Page