C extension with Ruby extras; preferred naming?

C

Clifford Heath

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.
 
T

Timothy Hunter

Clifford said:
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.
 
N

nobuyoshi nakada

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?
 
C

Clifford Heath

nobuyoshi said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top