[python-win32] Re: Extension and local data on win32
11 Nov 2002 21:29:22 +0100
Robert Olson <firstname.lastname@example.org> writes:
> The structure of the python interface is such that multiple extension
> modules are created, each linking in the C library that has the type
> structures. The problem is that when Windows loads the DLLs, it maps
> them into different address spaces. The result is that when an object
> created by calling one extension is passed through a method in another
> extension, comparisons made on the object pointers fail.
If I understand your problem correctly, you should change your code
so that this library is only linked into *one* extension.
If you need more than one extension module, you should probably
export some interface to the library from the first extension,
and use this from the other extensions.
> I can't change the behavior of this library; does anyone have any
> ideas on a solution? I've tried what MSDN howto Q109619 " Share All
> Data in a DLL" suggests by adding ["-section:.data,rws",
> "-section:.bss,rws"] to the extra_link_args keyword on the Extension
> in setup.py on all extensions built; no change.
I think this shares the data of a DLL between instances of the DLL
in different processes.