Standard IPC for Python?

Terry Reedy tjreedy at udel.edu
Tue Jan 13 18:47:35 EST 2009


Laszlo Nagy wrote:
> 
>>
>> I was suggesting getting posix_ipc or sysv_ipc to compile against a 
>> compatibility library (Cygwin?) under Windows. It sounds like you're 
>> proposing something totally different, no?
> OK I see. But probably I do not want to use Cygwin because that would 
> create another dependency. I understand that posix_ipc/sysv is not 
> natively supported under windows. What about this:
> 

A few comments: First, the issue of cross-platform IPC, and its 
difficulties, has come up occasionally, but most with the knowledge of 
writing stuff for one system (esp. Windows) tend to stick with that system.

> - create a wrapper, using ctypes, /windll / cdll/ to access API functions

ctypes was only added in 2.5.  It should make some things easier than 
they would have been before.

> - use CreateFileMapping on the page file to create shared memory (a la 
> windows: http://msdn.microsoft.com/en-us/library/aa366537.aspx)
> - use CreateEvent/WaitForSingleObject for signaling 
> (http://msdn.microsoft.com/en-us/library/ms682396(VS.85).aspx)
> - these should be enough to implement shared memory functions and 
> message queues under windows, and that might be a quick solution at 
> least for me.
> - it might also be used to emulate the same posix_ipc interface, without 
> any external dependency added (cygwin).

That would be good.

> 
> All I care about is to create a working message queue. But if you think 
> that this ctypes hack would be useful for other users, then I can try to 
> implement it.
> 
> I must tell you that I'm not very familiar with C programming (it was a 
> long time ago...) and I do not own MSVC.

Python compiles, I believe, with the free VCExpress.  But I would start 
with ctypes.




More information about the Python-list mailing list