[SciPy-dev] Weave, numpy, external libraries and conflicting typedefs
Travis Oliphant
oliphant at ee.byu.edu
Fri Jul 7 16:03:43 EDT 2006
Prabhu Ramachandran wrote:
>>>>>>"Travis" == Travis Oliphant <oliphant.travis at ieee.org> writes:
>>>>>>
>>>>>>
>
> >> Earlier, with Numeric, arrayobject.h did not define typedefs
> >> for the Int32 and so on. However, numpy defines several
> >> typedefs that conflict with the typedefs in Ygl.
>
> Travis> You need to #define PY_ARRAY_TYPES_PREFIX ygl_
>
> Travis> or something like that before including arrayobject.h
>
>Thanks! I tried to do this but there are more problems.
>arrayobject.h defines MAX/MIN macros. My own code defines these as
>generic functions. I can work around those easily, and after I did
>that I ended up with compilation errors below (where foo.cpp is the
>weave generated code):
>
>foo.cpp: In member function 'void numpy_type_handler::conversion_numpy_check_type(PyArrayObject*, int, const char*)':
>foo.cpp:494: error: expected primary-expression before ')' token
>foo.cpp:494: error: 'Bool' was not declared in this scope
>foo.cpp:494: error: expected primary-expression before 'int'
>foo.cpp:494: error: expected primary-expression before 'int'
>foo.cpp:494: error: expected `)' before 'PyArray_API'
>[...]
>
>
This should be fixed in SVN. Basically, we can't use the defined types
in the C-API.
Also, (in latest SVN) the MAXMIN macros can be avoided using
#define PYA_NOMAXMIN
before including arrayobject.h
-Travis
More information about the SciPy-Dev
mailing list