[Python-Dev] Static builds on Windows

Thomas Heller theller at python.net
Wed Jul 28 19:32:01 CEST 2004


I'm trying to build a static Python library on Windows.

Obviously this can be done by compiling the sources defining the
Py_NO_ENABLE_SHARED preprocessor symbol.

The resulting executable crashes when trying to load external extension
modules, because it tries to load another Python instance (from
python23.dll).

Much better, of course, would be if the executable wouild refuse to load
extension modules, which can be forced by commenting out the definition
of HAVE_DYNAMIC_LOADING in PC/pyconfig.h.

Now, shouldn't the definition of this symbol be protected by #ifndef
Py_NO_ENABLE_SHARED, or is there already a different mechanism (without
the need to change the source files)?

Thomas

Index: pyconfig.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v
retrieving revision 1.26
diff -c -r1.26 pyconfig.h
*** pyconfig.h	10 Feb 2004 16:50:19 -0000	1.26
--- pyconfig.h	28 Jul 2004 17:31:20 -0000
***************
*** 399,406 ****
--- 399,408 ----
  /* Define if you have clock.  */
  /* #define HAVE_CLOCK */
  
+ #ifndef Py_NO_ENABLE_SHARED
  /* Define when any dynamic module loading is enabled */
  #define HAVE_DYNAMIC_LOADING
+ #endif
  
  /* Define if you have ftime.  */
  #define HAVE_FTIME



More information about the Python-Dev mailing list