[fxruby-users] You should explain how "require" translates names.

lyle at knology.net
Thu, 30 Mar 2006 18:56:13 -0000

On Thu, 30 Mar 2006 10:46:36 -0700, Stephen Tashiro
<stephen.tashiro at us.army.mil> wrote :

> You do a good job of directing the Linux user to LD_LIBRARY_PATH and
> ldconfig.  But you frustrate people who "know exactly what your
talking
> about" in that regard but are new to Ruby.  What such a reader needs
to
> know is:
> How does
> require ''fox14''
> result in a search for  libFox1.4.so ?
> Should they try putting a full path name in the require?  Should they
> create a symbolic link from fox14 to libFox1.4.so?  Or is there some
> mapping of short names to library names that is configured in a file
> somewhere?    This is a key piece of information.

Stephen,

Thanks for pointing this out; it''s been a long time since I wrote that
part
of the documentation and no one''s really commented on it from this
perspective.

When Ruby sees:

    require ''fox14''

it goes looking in Ruby''s search path for a file named
"fox14.so". That
shared library contains the (compiled) C++ code that bridges between FOX and
Ruby. The problem that I was describing in the User''s Guide is that the
loader can''t find libFOX-1.4.so, which is a dependency of fox14.so.

So no, they shouldn''t put a full path name in the require statement --
Ruby
has already found "fox14.so", it just can''t find one of the
shared libraries
that "fox14.so" depends on. Nor should they create a symbolic link
between
fox14.so and libFOX-1.4.so -- they''re two completely different pieces
of code.

-- Lyle