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

Ulrich Eckhardt eckhardt at satorlaser.com
Mon Jan 26 17:31:37 CET 2009

On Sunday 25 January 2009, Luke Kenneth Casson Leighton wrote:
> 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?

I can only guess: The difference between code and data is that code can be 
loaded into a process by simply mapping it into the virtual memory. For data 
that is constant, the same applies. For non-const data, you absolutely must 
not do that though, because it would make processes interfere with each 
other, and that is what the above text probably means.

So, the important difference is rather that read-only stuff can be 
memory-mapped while read-write stuff can't. Since code is read-only (barring 
self-modifying code and trampolines etc), it is automatically always 

> 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.

Dump the address of said data and its size from inside that DLL and from 
outside just to see if they differ, both from the same process. I'd also dump 
the size, in case different compiler settings messed up padding or something 
like that.

> from looking so far. e.g. i expected MSVCRT.DLL errno to be an
> int - it's not: it's a function).

'errno' can't be an int, because it needs to be thread-local. Also, note the 
important difference between "errno is an int" and "errno yields an lvalue of 
type int". The latter is how the standard defines it.

> *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 :)

Can you reproduce this with a separate example?


Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
           Visit our website at <http://www.satorlaser.de/>
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.

More information about the Python-Dev mailing list