As recently discussed on the mailing list, NumPy's API is unnecessarily tricky to link from a non-C language because the numpy.core.multiarray._ARRAY_API lookup table of API pointers (PyArray_API in C) has a meaning that can only be determined by parsing the __multiarray_api.h header file.
A simple improvement would be to export an _ARRAY_API_NAMES variable (or similar) as well in Python, a simple list of strings corresponding to the symbols (PyArray_GetNDArrayCVersion etc.) pointed to by the ARRAY_API/PyArray_API array. This should hopefully be a straightforward modification to generate_numpy_api.py and related files. Or even just export the variables in the numpy/core/code_generators/numpy_api.py file.
@mwiebe I also suggest dynd as something you might want to take a look at.
Using a C++ library like DynD misses the point here: I am calling NumPy from a language that is not C or C++, without using C or C++ glue code. In order to use DynD I would need C++ glue code, whereas I want to do it purely from a high-level language (Julia, in my case). Currently that requires one to parse the .h file manually and to use undocumented NumPy internals.
We can do this. @stevengj Patches welcome.