[python-win32] Re: how to load 2 python COM DLLs in single app?

Niki Spahiev niki at vintech.bg
Fri Oct 29 14:37:45 CEST 2004


Thomas Heller wrote:
> Back to the original problem (using several frozen dll com servers in a
> single process), I envision these solutions, in increasing order of
> difficulty:
> 
> 1. Patch py2exe's code so that sys.path is not replaced but extended
> when Python is already initialized.  This gives no isolation between the
> com dlls (and the main process, if it also uses Python) at all.
> 
> 2. Run the com dll servers in different interpreters, with
> Py_NewInterpreter(). According to the python docs, extension modules
> are still shared - this may be good, or may be bad.
> 
> 3. Create completely standalone, single file dlls, with no external
> python.dll needed.

New idea:

4. Use load_dynamic() and prefix all dlls

_socket.pyd => prefix_socket.pyd

then load_dynamic( "_socket", path + "prefix_socket.pyd" )

and also rename py*23.dll to py*MN.dll (where M,N are random characters) 
and patch all pyd files to import from new names.

This looks like complete separation.

comments?

Niki Spahiev

P.S. maybe even prefix = MN


More information about the Python-win32 mailing list