[python-win32] Extension and local data on win32

Robert Olson olson@mcs.anl.gov
Mon, 11 Nov 2002 15:07:28 -0600

At 04:03 PM 11/11/2002 -0500, Jorgensen, Jens wrote:
>How interesting. You say that you're linking in the C library into each 
>.dll. Is your C library a static or shared lib? If it is a static lib then 
>the problem is apparent: each .dll gets a copy of that C library and thus 
>its own copy of the static-scoped type objects.

Yes, it is a static library (dll version is not supported).

>If this is the case then you'll have to restrict creation of these structs 
>to just one of the .dlls to make this work.

Hrm. It's fairly unclear how to make that happen; I suspect I'd have to 
break the library in two and just link the structure defs by themselves. (ugh).

>If the C library is a shared lib (.dll) itself then this is interesting. I 
>guess this would mean that each time the .dll is loaded the OS makes a new 
>copy of the data part of the image? I wouldn't think this would be the 
>case. I don't think Q109619 is what you want since this talks about 
>sharing data in a .dll among all processes and in your case this is all 
>within the same process.

Ah, right. That'd explain why it didn't work :-). I still hold out some 
hope that by subtle  manipulation of the compiler or runtime we can make 
this happen without hacking the library ...

thanks for the help,