Help to create a Ruby extension in C

Discussion in 'Ruby' started by Newb Newb, Apr 16, 2009.

  1. Newb Newb

    Newb Newb Guest

    hi..
    i just followed the peter cooper's tutorial on How to create a Ruby
    extension in C in under 5 minutes in the rubyinside.com.
    folowng the tutorial i create extconf.rb and MyTest.c .
    i installed the cygwin.

    in that command prompt i given command =>$ ruby extconf.rb

    after giving the command it created the makefile in to my folder.

    after that i given command => $ make

    it creates MyTest.o file and mytest(this file type is Apache Loadable
    Module)

    and no errors...

    it has not created the .so file into my folder...



    In irb when i give require 'mytest'

    the irb doesnot display anything...



    what is the problem..and what i m doing wrong....

    Kindly Help Me out...
    --
    Posted via http://www.ruby-forum.com/.
     
    Newb Newb, Apr 16, 2009
    #1
    1. Advertising

  2. Newb Newb wrote:
    > it creates MyTest.o file and mytest(this file type is Apache Loadable
    > Module)


    Possibly would be a DLL for Windows?

    > In irb when i give require 'mytest'
    >
    > the irb doesnot display anything...


    Can you paste *exactly* what you see? If it returns "true" then the
    extension was loaded correctly. Or did it crash IRB, i.e. you didn't
    even get a prompt back?
    --
    Posted via http://www.ruby-forum.com/.
     
    Brian Candler, Apr 16, 2009
    #2
    1. Advertising

  3. Newb Newb

    Newb Newb Guest

    Brian Candler wrote:
    > Newb Newb wrote:
    >> it creates MyTest.o file and mytest(this file type is Apache Loadable
    >> Module)

    >
    > Possibly would be a DLL for Windows?
    >
    >> In irb when i give require 'mytest'
    >>
    >> the irb doesnot display anything...

    >
    > Can you paste *exactly* what you see? If it returns "true" then the
    > extension was loaded correctly. Or did it crash IRB, i.e. you didn't
    > even get a prompt back?


    thank you..it actaully created .so file..
    but when i give require command it gives me true..
    but want to know wat it does when i give require 'mytest' command...
    and when i give command like require 'MyTest' command it shows me
    error..

    what is the reason

    Thanks
    --
    Posted via http://www.ruby-forum.com/.
     
    Newb Newb, Apr 16, 2009
    #3
  4. Newb Newb

    Ryan Davis Guest

    On Apr 16, 2009, at 00:22 , Newb Newb wrote:

    > thank you..it actaully created .so file..
    > but when i give require command it gives me true..
    > but want to know wat it does when i give require 'mytest' command...
    > and when i give command like require 'MyTest' command it shows me
    > error..
    > what is the reason


    the file is named "mytest.so" and you're probably on a case sensitive
    file system. I'm guessing you don't have a file named MyTest.so
    (or .rb).

    look at your doco for Kernel#require to see what it does. You can use
    `ri` for that or look it up on rubydoc or somesuch.
     
    Ryan Davis, Apr 16, 2009
    #4
    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:
    919
    Tim Daneliuk
    Nov 8, 2003
  2. Christian Seberino
    Replies:
    3
    Views:
    1,220
    Christian Seberino
    Feb 5, 2004
  3. Nicholas
    Replies:
    3
    Views:
    408
    Ryan Davis
    Jan 28, 2007
  4. barabba
    Replies:
    5
    Views:
    277
    barabba
    Apr 12, 2007
  5. Iñaki Baz Castillo
    Replies:
    2
    Views:
    242
    Iñaki Baz Castillo
    Apr 20, 2011
Loading...

Share This Page