[PYTHON MATRIX-SIG] Just checking in

Guido van Rossum guido@CNRI.Reston.Va.US
Thu, 29 Aug 1996 09:48:36 -0400

> As for HP systems, I am reasonably convinced that the problem with
> NumPy alpha2 is the fake module "libnumpy". After a careful study of
> the HP documentation, I conclude that there are two ways to use
> shared libraries:
> 1) Explicit loading, which is what Python does when importing
>    a module.
> 2) Linking with a shared library, which is then loaded as soon as
>    one of its functions is called. This works only if the shared
>    library is in the same place as it was during linking. (Other
>    systems, e.g. SGI, let the user specify a search path for this
>    case.)
> NumPy uses the second method for libnumpy (which contains
> arrayobject.o and ofuncobject.o), but after installation it must fail.

This makes sense after all.  Unless libNumPy.sl is placed in one of
the standard places where the linker looks for shared libraries, it
will need some strong hints.  It could be that this problem doesn't
occur on Solaris because the linker will look in the same directory
where the referring shared library is coming from.

However, if I read the "ld" man page right for HP-UX, the "+b" option
should let you specify a list of directories to search for shared
libraries at run-time.  It may be that this information only gets used
when building the main executable, in which case you can specify a
SHLIB_PATH environment variable pointing to the directory containing
libNumPy.sl (see the +s option).

> A possible solution would be to make libnumpy a real importable
> module and import it from the modules that need it.

Yes, that's another approach.  The Object/cobject.c file contains a
little-known trick to make this easier.  However I'm not sure it's
worth it, assuming this problem is HP specific.  The environment
variable trick seems okay.  (Note that in 1.4b3 you can use
os.putenv() to modify the real environment of the current process, so
you could even hide this in a wrapper written in Python!)

--Guido van Rossum (home page: http://www.python.org/~guido/)

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org