Inter-process communication

Dar Scott dsc at swcp.com
Sun Jan 2 16:33:56 EST 2005


On Jan 1, 2005, at 7:01 PM, Gordon Webster wrote:

> Is it sensible/feasible to use the clipboard for
> communicating between rev and other processes?

I do not use it for the kind of thing you are describing, so I'm a 
little prejudiced.  I lean against this, but I'm all for creative 
solutions.

> e.g. suppose I want to pass control to another process
> that does a large, numerically intensive calculation
> and then passes the result back to the rev app by
> writing to the clipboard. This assumes that the
> overhead of parsing the result on the clipboard is
> more than offset by the time saved by doing the
> calculation in a separate, natively compiled process.

You have several options in communicating with another process.

> Would this be quicker than communicating using files?

Maybe.  But perhaps not for large files.

1
You could use the Revolution shell() function.  That will return the 
stdout output of the process.  On Windows it messes with the line ends, 
so binary output is needs to be encoded.  You would need a file for 
input only.

That means running the process for each job for the other process.

This can be scripted very quickly on the Revolution side, so I'd go 
this way and then change if it is too slow.

2
You could use 'open process' to keep the other process running.  Your 
options for communication include these:

    A.  the 'process' I/O (stdin & stdout of the process)
        (I have had limited success.)

    B.  TCP/IP

    C.  Named pipes?  (I haven't tried this on Windows.)

    D.  Files in a folder in-basket


> Of course, using the externals SDK to access a DLL
> would be optimal - is there a tutorial somewhere on
> how to access the functions in a DLL from within rev?

There are some materials on making an external for Windows.  The 
external can access a DLL.

> Would I have to write a C program to do this?

A Windows external is a DLL and it is best to write it in C.

If you have access to the source of the original DLL, maybe there is a 
way to expand it to be act as the external, also.

**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming Services and Software
**********************************************



More information about the use-livecode mailing list