python, dlls, and multiple instances
"Martin v. Löwis"
martin at v.loewis.de
Sun Jun 1 20:42:30 CEST 2008
> Is it a correct to assume that you can use multiple instances of
> python altogether if each is loaded from a separate dll? For instance,
> if I write a couple of dll/so libs, and each has python statically
> linked in, is it safe to assume that since dlls use their own address
DLLs don't use their own address space. All DLLs of a single operating
system process use the same address space.
Different DLLs do use different portions of that address space.
> then each dll would have it's own GIL, and will therefore
> coexist safely within the same app? This is correct across all
> platforms, yes?
No; it rather depends on the way the operating system resolves symbols.
On some systems (e.g. many Unix systems), there is only a single global
symbol table for the entire process. So when a shared library is loaded,
and needs to resolve its symbols (even the ones that it also defines
itself), it may end up finding the GIL in a different copy of the Python
interpreter, so they all share the GIL (even though there would have
been space for multiple GILs).
More information about the Python-list