Forum: Ruby Help to create a Ruby extension in C

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-04-16 06:49
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...
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-04-16 09:12
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?
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-04-16 09:22
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
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-04-16 10:37
(Received via mailing list)
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.
This topic is locked and can not be replied to.