[Python-Dev] Static builds on Windows

Thomas Heller theller at python.net
Thu Jul 29 21:10:47 CEST 2004


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Thomas Heller wrote:
>> I guess you need a def file as well, or another way to define the
>> exported functions?
>
> I'd assume that the current mechanism of DL_EXPORT stays. Then, the
> DLL project simply needs to link all object files together - either
> by referencing symbols, or by explicitly linking all object files
> together into a DLL. The __declspec(dllexport) declarations will
> cause the proper symbols to get exported.

I'm lost in these symbols.  It seems, the DL_EXPORT symbol is already
deprecated, and public functions should be, and are, declared
PyAPI_FUNC.  OTOH, the only way to define PyAPI_FUNC as
__declspec(dllexport) is to define Py_ENABLE_SHARED and Py_BUILD_CORE.
And isn't Py_ENABLE_SHARED mutually exclusive with Py_NO_ENABLE_SHARED?

> Of course, the same will happen if the static library is incorporated
> into an executable - that will also export all symbols.

Which makes the exe slightly larger, because of the import table
section.  I have yet to figure out if extensions can link to these
functions - normally they expect the functions in the pythonxy.dll
module, and not in the (say) python_static.exe.

Thomas



More information about the Python-Dev mailing list