[Numpy-discussion] static pointer

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed May 2 13:39:11 EDT 2001

> If I understand correctly, the addition of the static keyword means that the
> import_array() function can now only be used by extensions that are defined
> in a single C source file. I can easily work around this problem, by

True. That's exactly what I pointed out in a previous message in this

> defining my own api pointer, and using a modified import_array() in my code,

That seems to me the preferred solution.

> built ok, and we were formerly not following the instructions in the Python
> documentation and now we are. And, OS-X now worked. So far so good. If I

And those instructions mention the static keyword for a good reason:
without it there are problems not only with portability, but also with
static linking of extension modules.

> Is there a way of institutionalizing your work-around so that others can use
> it?

I thought about providing a general solution right in the header
files. The problem is the generation of a unique symbol by
preprocessor tricks, perhaps somehow based on the module name.
I don't see how this can be done.

On the other hand, if we accept that the extension module programmer
has to supply a unique symbol, then it is even easy. This would only
be necessary for multi-file extension modules. Does that seem like a
good solution?

> Wait. I have an idea. Konrad was the one who put all this in. He should be
> punished for his good deed...(:->

I am even thinking of punishing myself by imposing extra work on me! ;-)

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