Permalink
Browse files

Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each exten…

…sion.

By using a unique symbol for each extension we prevent multiple
definition linking errors which arise when statically linking
a Python interpreter.

Closes gh-2039.
  • Loading branch information...
1 parent b02b701 commit 40bbb9bd8d0e0eaf24c6815b31a05b4ee5a53439 @bfroehle committed May 21, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 setupext.py
View
@@ -648,8 +648,12 @@ def check(self):
def add_flags(self, ext):
import numpy
+ # Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for
+ # each extension
+ array_api_name = 'MPL_' + ext.name.replace('.', '_') + '_ARRAY_API'
+
ext.include_dirs.append(numpy.get_include())
- ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'))
+ ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL', array_api_name))
class CXX(SetupPackage):

0 comments on commit 40bbb9b

Please sign in to comment.