Connecting to running win32com server

Alex Martelli aleaxit at yahoo.com
Tue Oct 10 15:21:29 EDT 2000


"ghubbar" <ghubbar at sandia.gov> wrote in message
news:39E3539D.559BB60E at sandia.gov...
    [snip]
> things to communicate, but it seems that the C++ program always starts
> a new python process to handle the request, rather than using the
> already running one.  This won't work for me, as the purpose is to
> grab data being collected by the already running python script.
>
> Is there some way around this, other than tricks like shared memory
> between the running python process and the win32com server?  The
> C++ code and the data collection program run on different computers.

Sure.  The server must register itself with the system as
REGCLS_MULTIPLEUSE (in the CoRegisterClassObject API call),
so that only one instance of its process will be run (and the
classobject it registers must return either references to one
and the same instance [singleton], or, my preference [for
reasons that may be slightly obscure to explain], instances
that all share their state [delegating it to a shared singleton
internal non-com-exposed object in the process]).

(I thought that's what win32com.server.factory did by
default... the multi-use part, I mean... are you sure that
multiple _processes_ are starting, rather than just there
being multiple instances within the same Python process?)


Alex






More information about the Python-list mailing list