Cross-references between dynamically loaded modules under AIX

Konrad Hinsen hinsen at cnrs-orleans.fr
Mon May 3 03:39:34 EDT 1999


Jakob Schiotz <jschiotz at hotmail.com> writes:

> a NumPy array (I am using SWIG), the program is appended below.  It
> works fine on an alpha processor running OSF1 V4.0, but it coredumps
> under AIX version 4.1.5.  The coredump occurs when PyArray_FromDims is
> called.  It looks like the dynamical loader under AIX cannot resolve
> symbols in one module that refers to another module.  It is probably
> related to the primitive way dynamic loading is working under AIX.

Not really. Most Unix systems let you choose whether symbols in shared
libraries are globally visible or not, AIX just does it in a different
way. Python (at least the most recent versions) defaults to *not*
making these symbols global on systems that allow this. So your problem
is not specific to AIX.

The preferred way to get access to symbols from another shared library
is importing this library (via Python's module import mechanism) and
retrieving the addresses via CObjects. NumPy does this for you
automatically (unless you have a really old version); all you have to
do is to add a call to import_array() in the initialization function
of your module.


I am not a SWIG expert, but I suppose all you have to do is to add one
line here:

> %init %{
>     setdefaults();
-->   import_array();
>     fprintf(stderr, "FAST: %s %s\n", __DATE__, __TIME__);
> %}

-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Python-list mailing list