[Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules. (original) (raw)
Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Jan 25 19:45:13 CET 2009
- Previous message: [Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules.
- Next message: [Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Jan 25, 2009 at 9:01 AM, Matthieu Brucher <matthieu.brucher at gmail.com> wrote: > 2009/1/25 Luke Kenneth Casson Leighton : >> according to the wikipedia entry on dlls, dlls do not support data, >> only functions. > > What do you mean by "not support data"? Having global data variables in a dll? > In wikipedia, it is explicitely told that this is possible to have > data (http://en.wikipedia.org/wiki/Dynamic-linklibrary). Without > them, shared library cannot be used.
matthieu, thank you for responding. from http://en.wikipedia.org/wiki/Dynamic-link_library:
"Third, dynamic linking is inherently the wrong model for paged memory managed systems. Such systems work best with the idea that code is invariant from the time of assembly/compilation on. ........... Data references do not need to be so vectored because DLLs do not share data." ^^^^^^^^^^^^^^^^^^^^
does anyone happen to know what this means?
also, what do you mean by "without data, shared library cannot be used"? you can always call a function which returns a pointer to the data, rather than access the data directly.
Indeed. That's why the header files contain _define PyAPIDATA(RTYPE) extern declspec(dllexport) RTYPE _define PyAPIDATA(RTYPE) extern declspec(dllimport) RTYPE
curt, thank you for responding. i'd seen this: i understood it - and... yet... mingw happily segfaults when asked to access any data in any object file of the python2N dll.
Py_NoneStruct, PyExc_* (of which there are about 50), Py*_Type - all of them.
solutions so far involve ensuring that anything declared with PyAPI_DATA is NEVER accessed [across a dll boundary] - by for example moving the module into python2N.dll.
also, yes i had looked up how to do .def files, and how __declspec(dllexport) etc. work. of all the examples that you find about dlltool, mingw, dlls, defs, etc. they all say "function." to declare a function you do X, Y and Z. not one of them says "to place data in a dll, you do X Y and Z".
then, looking at the wine dlls and .defs, i haven't yet found a single one which returns data - they're all functions (from looking so far. e.g. i expected MSVCRT.DLL errno to be an int - it's not: it's a function).
sigh. if this turns out to be yet another gcc / mingw bug i'm going to be slightly annoyed. only slightly, because this is free software, after all :)
l.
- Previous message: [Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules.
- Next message: [Python-Dev] microsoft dlls apparently don't support data. implications: PyAPI functions required to access data across modules.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]