shared lib from python code?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Mon Feb 23 12:43:18 CET 2009


Gabriel Rossetti wrote:
> Hello everyone,
>
> I would like to know if it is possible to turn python code into a 
> shared lib? I have several processes that use the same base code, and 
> it seems like every process loads the "shared" code into memory. I 
> would like it to be loaded once and shared, like a .so in linux or a 
> .dll in windows and have the interpreters use the dared copy. Is there 
> a way to do this?
>
> Thank you,
> Gabriel
>
Ok, maybe I mis-stated my problem (or mis-understood your answers).. I 
don' t want to share code as in have multiple processes access a 
variable and have the same value, like it is done in threads, what I 
want is to not have n copies of the code (classes, functions, etc) 
loaded by n python interpreters. When you load Apache for instance, it 
runs n processes but loads only one copy of parts of it's code (so/dll), 
that's what I want to do. In C/C++ I would write a shared-lib (so/dll), 
so once the system has loaded it, it doesn' t re-load it when another 
process needs it.

Thank you,
Gabriel



More information about the Python-list mailing list