Skip to content

BUG: Use C linkage for random distributions#18328

Merged
charris merged 2 commits intonumpy:maintenance/1.20.xfrom
charris:backport-18264
Feb 4, 2021
Merged

BUG: Use C linkage for random distributions#18328
charris merged 2 commits intonumpy:maintenance/1.20.xfrom
charris:backport-18264

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented Feb 4, 2021

Backport of #18264.

When using the numpy.random C API with Cython as described in examples with C++ sources instead of C sources, C++ name mangling will prevent correctly linking to symbols in the npyrandom static library which has C linkage. A work-around is described here, but it seems like adding some extern "C" declarations should do the trick. These are found in nearly all other numpy header files, e.g. npy_math.h.

Someone else may need to comment on why cffi extending tests are failing, I am unfamiliar with cffi. EDIT: filtering out extern "C" statements was enough to get the tests working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants