
On Mon, May 3, 2010 at 7:23 PM, Austin Bingham <austin.bingham@gmail.com> wrote:
Hi everyone,
I've recently been developing a python module and C++ library in parallel, with core functionality in python and C++ largely just layered on top of the python (with boost.python.) In some cases, however, for performance reasons, the C++ API "reaches into" the python code via the C API, and this tends to happen very often with numpy-related code.
As a result, I'm using the numpy C API a lot in my C++ library. To make a long story short, I'm finding that there are many places where I need to include numpy headers in my own headers (e.g. when a template class uses part of the numpy API.) If the symbol I want in my header is in ndarrayobject.h, it seems that I'm obligated to define PY_ARRAY_UNIQUE_SYMBOL because that file includes __multiarray_api.h. However, defining that macro in a header file seems like a bad idea because of potential conflicts with headers from other libraries.
You don't need to define PY_ARRAY_UNIQUE_SYMBOL to include any public numpy header - it seems that you are trying to avoid getting PyArray_API defined, but I don't understand why. PY_ARRAY_UNIQUE_SYMBOL should only be used when you want to split your extension into separately compilation units (object files). David