[Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules.

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Jan 25 17:15:28 CET 2009


On Sun, Jan 25, 2009 at 3:58 PM, Luke Kenneth Casson Leighton
<lkcl at lkcl.net> wrote:
> according to the wikipedia entry on dlls, dlls do not support data,
> only functions.  which would explain two things:
> 1) why certain modules are forcibly linked into pythonNN.dll
> 2) why attempts to move them out of pythonNN.dll cause runtime crashes.
> so i will continue the experiment, and remove all the "data"
> references from the pythonNN.def that i added, and deal with the
> knock-on consequences, which will involve adding "get" functions.
>
> for example, PyAPI_FUNC(char*) _PyStructSequence_Get_UnnamedField(void)
>
> use of such functions will allow various bits and pieces - such as
> PyStructSequence_UnnamedField - to be converted back to static in
> their respective c files.
>
> any objections, speak now, because this will involve quite a bit of work.

here is a starting list of data items which will require "getter"
functions, found just by creating a posixmodule.pyd:

Info: resolving __Py_NoneStruct by linking to __imp___Py_NoneStruct
(auto-import)
Info: resolving _Py_FileSystemDefaultEncoding by linking to
__imp__Py_FileSystemDefaultEncoding (auto-import)
Info: resolving _PyExc_OSError by linking to __imp__PyExc_OSError (auto-import)
Info: resolving _PyUnicode_Type by linking to __imp__PyUnicode_Type
(auto-import)
Info: resolving _PyFloat_Type by linking to __imp__PyFloat_Type (auto-import)
Info: resolving _PyExc_TypeError by linking to __imp__PyExc_TypeError
(auto-impoModules/posixmodule.ort)
Info: resolving _PyExc_RuntimeError by linking to
__imp__PyExc_RuntimeError (auto-import)
Info: resolving _PyExc_ValueError by linking to
__imp__PyExc_ValueError (auto-import)
Info: resolving _PyExc_RuntimeWarning by linking to
__imp__PyExc_RuntimeWarning (auto-import)
Info: resolving _PyExc_NotImplementedError by linking to
__imp__PyExc_NotImplementedError (auto-import)

obviously, auto-import can't happen.  so getter-functions it is.

l.


More information about the Python-Dev mailing list