[Numpy-discussion] Meta: too many numerical libraries doing thesame

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Nov 28 00:09:03 CST 2001

"eric" <eric at enthought.com> writes:

> The standard version that Robin Dunn distributes is compiled with MSVC.  If
> you build a small
> extensions with gcc that make wxPython call, it'll link just fine, but
> seg-faults during execution.
> Does anyone know if the same sorta thing is true on the Unices?  If it is,
> and Numeric was written in C++ then you'd have to compile extension modules
> that use Numeric arrays with the same compiler that was used to compile
> Numeric.  This can lead to all sorts of hassles, and it has made me lean

If you rely on dynamic linking for cross-module calls, you'd have the
same problem with Unix, as different compilers use different
name-mangling schemes. One way around this would be to limit
cross-module calls to C functions compiled with "C" linking.

Better yet, don't rely on dynamic linking at all and export a module's
C API via a Python CObject, as described in the extension manual, and
declare all symbols as static (except for the module initialization
function of course). In my experience that is the only method that
works on all platforms, with all compilers. Of course this also
assumes that interfaces are at the C level.

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

More information about the Numpy-discussion mailing list