[Numpy-discussion] Quick question on NumPy builds vs. Cython
Tue Aug 25 12:30:49 CDT 2009
On Tue, Aug 25, 2009 at 12:19 PM, Dag Sverre
> [Let me know if this should go to numpy-discuss instead.]
I guess this can be discussed on the ML as well (I CC to the list).
> I see that there are currently two modes, and that it is possible to build
> NumPy using a master .c-file #include-ing the rest. (Which is much more
> difficult to support using Cython, though not impossible.)
> Is there any plans for the one-file build to go away, or is supporting this
> a requirement?
This is a requirement, as supporting this depends on non standard
compilers extensions (that's why it is not the default - but it works
well, I am always using this mode when working on numpy since the
build/test/debug cycle is so much shorter with numscons and this).
The basic problem is as follows:
- On Unix at least, a function is exported in a shared library by default.
- The usual way to avoid polluting the namespace is to put static in
front of it
- You can't reuse a static function in another compilation unit
(there is no "friend static").
So what happens in the multi-files build is that the function are
tagged as hidden instead of static, with hidden being
__attribute__((hidden)) for gcc, nothing for MS compiler (on windows,
you have to tag the exported functions, nothing is exported by
default), and will break on other platforms.
More information about the NumPy-Discussion