[Python-Dev] Static builds on Windows (continued)

Marvin marvinpublic at comcast.net
Wed Oct 5 00:05:20 CEST 2005

Earlier references:

I want to be able to create a version of python24.lib that is a static library,
suitable for creating a python.exe or other .exe using python's api.

So I did as the earlier poster suggested, using 2.4.1 sources.  I modified the
PCBuild/pythoncore and python .vcproj files as follows:

  General/ ConfigurationType/ Static library (was dynamic in pythoncore)
  c/C++ Code Generation RT Library /MT (was /MTD for mt DLL)
  c/c++/Precompiled/ Not Using Precompiled headers (based on some MSDN hints)
  librarian OutputFile .//python24.lib
  Preprocessor: added Py_NO_ENABLED_SHARED. Removed USE_DL_IMPORT

I built pythoncore and python. The resulting python.exe worked fine, but did
indeed fail when I tried to dynamically load anything (Dialog said: the
application terminated abnormally)

Now I am not very clueful about the dllimport/dllexport business.  But it seems
that I should be able to link MY program against a .lib somehow (a real lib),
and let the .EXE export the symbols somehow.

My first guess is to try to use /MTD, use Py_NO_ENABLE_SHARED when building
python24.lib, but then use PY_ENABLE_SHARED when compiling the python.c.  I'll
try that later, but anyone have more insight into the right way to do this?


More information about the Python-Dev mailing list