[Python-Dev] Review of build system patch requested

Mark Hammond mhammond@skippinet.com.au
Wed, 17 Jul 2002 23:37:06 +1000


I would like review of a patch that touches the configure/build system.

The patch is to fix/deprecate the DL_IMPORT macros that pepper the Python
source code.  These macros were originally introduced for the Windows port
many years ago as a way of declaring special linkage for the Python API
functions and data exposed in the Python DLL.  It has since been used in the
cygwin and BeOS ports, and, to put it bluntly, is broken!

The patch touches the configure/build system to provide a consistent
mechanism for declaring special linkage macros regardless of platform.
Specifically:

* configure.in has been changed to #define Py_ENABLE_SHARED in pyconfig.h if
Python has been configured for building as a shared library.

* Makefile.pre.in has been changed to pass "-DPy_BUILD_CORE" to the compiler
when building Python itself and any builtin modules.  This flag is not
passed to extension modules.

* pyport.h has been changed to define the macros PyAPI_FUNC, PyAPI_DATA and
PyMODINIT_FUNC.  For Windows, cygwin and BeOS, these will resolve to
"__declspec" directives (depending on Py_ENABLE_SHARED and Py_BUILD_CORE).
For all other platforms these will resolve to nothing.

The patch also contains significant changes to PC/pyconfig.h - while reviews
of that code are welcome, I am primarily interested in reviews of the above
three points, and some indication from gurus on Linux and other platforms
that these changes are reasonable (or if I am lucky, desirable <wink>)

www.python.org/sf/566100 - Patch [ 566100 ] Rationalize DL_IMPORT and
DL_EXPORT

Thanks,

Mark.