Microsoft KB Archive/61670

INF: Interprocess Communication Between 3.x Box & OS/2 Process PSS ID Number: Q61670 Article last modified on 09-12-1991 PSS database name: O_Os2SDK

1.10 1.21

OS/2

Summary:

Listed below are some questions involving the forms of IPC (interprocess communication) possible between the DOS compatibility (3.x) box and an OS/2 process.

More Information:

  Can OS/2 IPCs, such as pipes, queues, or shared memory, operate in conjunction with an application running in the DOS compatibility box? Queues will not work between the DOS compatibility box and an OS/2 application. Shared memory is possible; however, it would require that a device driver be written. This device driver would have to bypass many of OS/2’s protection safeguards, and it would be a relatively difficult thing to do. Microsoft does not recommend that this alternative be used. Named pipes, however, will work, and are the best solution. The named pipe mechanism is also fully supported by the operating system. In the Software/Data Library is a file named DOSPIPE that contains two sample programs. One program runs under MS-DOS only, and the other program runs under OS/2 only. Both of these programs communicate successfully via a named pipe. DOSPIPE can be found in the Software/Data Library by searching on the word DOSPIPE, the Q number of this article, or S12577. DOSPIPE was archived using the PKware file-compression utility. Also, page 35 in the September 1989 issue (volume 4, number 5) of the “Microsoft Systems Journal” contains an excellent article (“A Complete Guide to OS/2 Interprocess Communications and Device Monitors” by Richard Hale Shaw) on IPCs and communicating with the DOS compatibility box via named pipes.   An application in the DOS compatibility box can write to a file on a FAT volume and that file can then be read by an OS/2 process. These events could be synchronized in several ways, perhaps most simply by having the OS/2 thread block on the file be available for it to open, and issuing a DosSleep call immediately after closing it, and so on. Even though this is clumsy and probably slow, will it work? Yes, this is probably the slowest way; however, it will work as outlined above.   Can the clipboard be used in conjunction with an application running in the DOS compatibility box? No, the clipboard cannot be accessed from the DOS compatibility box.   Can DDE (dynamic data exchange) be used in conjunction with an application running in the DOS compatibility box? No, DDE cannot be used from the DOS compatibility box. 

Table of Possibilities (Y=Yes, N=No)
The following table summarizes the advantages and disadvantages of using the IPC mechanisms listed above. This table applies to OS/2 versions 1.1 and 1.21 (for both FAT and HPFS):

IPC Mechanism Availability ————- ————

Queues N Shared memory Y (however, it is the most difficult) Named pipes Y (best solution, easy, supported by operating system) Synchroned read/write Y (slowest, however it is the easiest) Clipboard N DDE N

We strongly recommend that named pipes be used; it will be the easiest option to code and maintain in future versions of OS/2, and it is considered to be a “clean” solution. Please see the sample applications in DOSPIPE to see how this is done.

Copyright Microsoft Corporation 1991.