From: Michael Kelly Date: 2001-12-31T03:00:30+09:00 Subject: [ruby-talk:29735] Re: Communicating with C/C++ program On 30 Dec 2001 06:39:57 -0800, hubert@cs.nyu.edu (Hubert Hung-Hsien Chang) wrote: >What if I want not only to issue a command from C and ask Ruby to do something >but also getting the result from Ruby? Is socket the only way to do it? On Win32 the most common communication techniques between processes are messaging and memory mapped files. You can send another window(belonging to another application) a message signifying a command and possibly get the data back by sending a WM_COPYDATA message. Or you can use a memory mapped file as a communcation area between the processes. The memory mapped files sound harder to use than they really are. You can use a file handle of -1 to create shared memory backed by the system swap file. In the shared memory you can create data structures etc.. Usually you synchronize reads and writes to the memory mapped file using a mutex. You can probably find an IDispatch-based memory mapped file component freeware. Then you just create an instance of it from any programming language that can use IDispatch. I know Ruby can using the WIN32OLE module. Mike -- "I don't want to belong to any club that would have me as a member." -- Groucho Marx