C extension with Ruby extras; preferred naming?

Discussion in 'Ruby' started by Clifford Heath, Aug 22, 2005.

  1. I recently published the OneWire module, which wraps parts of
    the Dallas/Maxim Onewire API (for their IButton hardware),
    see <http://onewire.rubyforge.org/>.

    The extension DLL/shared library is called "onewire", but I
    also have some Ruby code that extends the same OneWire module.
    I tried to name it "onewire.rb", which has "require onewire.so",
    but the loader gets confused and only loads the DLL, not the
    Ruby module (then the DLL),

    What's the preferred way to handle this naming conflict? I'd
    rather not rewrite the Ruby in C, and I'd prefer to avoid
    renaming the DLL. Is there a third alternative?

    Clifford Heath.
     
    Clifford Heath, Aug 22, 2005
    #1
    1. Advertising

  2. Clifford Heath wrote:
    > I recently published the OneWire module, which wraps parts of
    > the Dallas/Maxim Onewire API (for their IButton hardware),
    > see <http://onewire.rubyforge.org/>.
    >
    > The extension DLL/shared library is called "onewire", but I
    > also have some Ruby code that extends the same OneWire module.
    > I tried to name it "onewire.rb", which has "require onewire.so",
    > but the loader gets confused and only loads the DLL, not the
    > Ruby module (then the DLL),
    >
    > What's the preferred way to handle this naming conflict? I'd
    > rather not rewrite the Ruby in C, and I'd prefer to avoid
    > renaming the DLL. Is there a third alternative?
    >
    > Clifford Heath.


    Hmmm...RMagick does exactly what you describe: RMagick.rb loads
    RMagick.so. I'm not sure why RMagick would work and onewire wouldn't.
     
    Timothy Hunter, Aug 22, 2005
    #2
    1. Advertising

  3. Hi,

    At Mon, 22 Aug 2005 20:16:18 +0900,
    Clifford Heath wrote in [ruby-talk:153215]:
    > The extension DLL/shared library is called "onewire", but I
    > also have some Ruby code that extends the same OneWire module.
    > I tried to name it "onewire.rb", which has "require onewire.so",
    > but the loader gets confused and only loads the DLL, not the
    > Ruby module (then the DLL),


    Requiring with explicit ".so" suffix should load an extension
    library even if ".rb" version is loaded already.

    What does happen exactly at `require "onewire.so"', LoadError,
    just false returns, or something else?

    And where do you put them?

    --
    Nobu Nakada
     
    nobuyoshi nakada, Aug 23, 2005
    #3
  4. nobuyoshi nakada wrote:
    > What does happen exactly at `require "onewire.so"', LoadError,
    > just false returns, or something else?
    > And where do you put them?


    I think I made the mistake of putting the .so in the top
    level directory where the .rb file was, instead of under
    i386... Seems to work correctly now, sorry to bother you all.
     
    Clifford Heath, Aug 23, 2005
    #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. Replies:
    7
    Views:
    553
  2. Harman
    Replies:
    1
    Views:
    2,525
    Moiristo
    Jul 28, 2006
  3. Flash Gordon

    [semi OT] CLC Wiki Relaunch + Free Extras

    Flash Gordon, Jan 27, 2007, in forum: C Programming
    Replies:
    12
    Views:
    581
    Malcolm McLean
    Jan 30, 2007
  4. howa

    Preferred naming?

    howa, Sep 16, 2007, in forum: XML
    Replies:
    5
    Views:
    388
    Joe Kesselman
    Sep 17, 2007
  5. Huw Collingbourne
    Replies:
    0
    Views:
    140
    Huw Collingbourne
    Oct 22, 2007
Loading...

Share This Page