Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Help to create a Ruby extension in C

Reply
Thread Tools

Help to create a Ruby extension in C

 
 
Newb Newb
Guest
Posts: n/a
 
      04-16-2009
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/.

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      04-16-2009
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/.

 
Reply With Quote
 
 
 
 
Newb Newb
Guest
Posts: n/a
 
      04-16-2009
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/.

 
Reply With Quote
 
Ryan Davis
Guest
Posts: n/a
 
      04-16-2009

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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a custom Ruby C extension method from other C extension IƱaki Baz Castillo Ruby 2 04-20-2011 12:24 PM
Internet Explorer Browser Extension: Switching from Live to Development and back again with a browser extension or BHO--how to create it? Danny Javascript 11 06-27-2007 01:50 PM
Ruby C extension crash: how to create a stack trace? barabba Ruby 5 04-12-2007 12:06 AM
Ruby extension (C++) on OS X [ruby 1.8.2] and Google-Sketchup [ruby 1.8.5] Nicholas Ruby 3 01-28-2007 01:48 AM
New extension? saw extension .emf is it safe to open Jer Computer Support 5 10-08-2005 04:43 PM



Advertisments