From: Tim Hunter Date: 2006-03-20T21:18:49+09:00 Subject: Re: .rb file includes c-extension of same name? Bill Kelly wrote: > Hi, > > I have foo.rb and foo.so, the C-extension part of the module. > > Inside foo.rb, I can put, require 'foo.so', and it works fine, > allowing other modules to say require 'foo', and have the .rb > be loaded, which in turn loads the C-extension. > > I'm wondering if there's a recommended platform-independent > way to do this? For instance, on OS X, C-extensions end in > ".bundle" not ".so". > > I wouldn't mind even saying require "foo.#{DLEXT}", if there > were such a thing available from ruby. > > Is there a recommended way to have a .rb file require a C-extension file > of the same name in a platform-independent > way? Or is the preferred solution to alter the name of one > of the two files? > > > Thanks, > > Bill > > > > You can just always use ".so". Ruby is clever enough to figure out what ".so" really means on the current platform.