Skip to content

Commit

Permalink
Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each exten…
Browse files Browse the repository at this point in the history
…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
bfroehle committed May 21, 2013
1 parent b02b701 commit 40bbb9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 40bbb9b

Please sign in to comment.