Static builds on Windows (continued)

Earlier references: http://mail.python.org/pipermail/python-dev/2004-July/046499.html 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? marvin

Marvin wrote:
Not sure what you are trying to do here. In your case, dynamic loading simply cannot work. The extension modules all link with python24.dll, which you don't have. It may find some python24.dll, which then gives conflicts with the Python interpreter that is already running. So what you really should do is disable dynamic loading entirely. To do so, remove dynload_win from your project, and #undef HAVE_DYNAMIC_LOADING in PC/pyconfig.h. Not sure if anybody has recently tested whether this configuration actually works - if you find that it doesn't, please post your patches to sf.net/projects/python. If you really want to provide dynamic loading of some kind, you should arrange the extension modules to import the symbols from your .exe. Linking the exe should generate an import library, and you should link the extensions against that. HTH, Martin
participants (2)
-
"Martin v. Löwis"
-
Marvin