- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have two applications communcating via pipes and re-directed standard input and standard output. However this only allows formated data. The reason for having commincationis because the front end is a 32 bit legacy application which will take years to convert to 64 bit. This comminicates with a new 64 bit application written in Fortran.
I want to use unformatted (binary) communication over the pipes. I think I am supposed to open a file on the pipe but how?
Andy
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have two applications communcating via pipes and re-directed standard input and standard output. However this only allows formated data. The reason for having commincationis because the front end is a 32 bit legacy application which will take years to convert to 64 bit. This comminicates with a new 64 bit application written in Fortran.
I want to use unformatted (binary) communication over the pipes. I think I am supposed to open a file on the pipe but how?
Redirecting of STDIO/STDOUT is just a convenience. In this way, you can use standard Fortran READ(*) and WRITE(*) rather than relatively cumbersome ReadFile/WriteFile. With a "pure" Win32 API solution, you would use ReadFile/WriteFile to communicate through the pipe (as, mostly in the original example). Obviously, you cannot use FORM="Unformatted" or "Binary" on unit *, though.
To get the best of both worlds (flexibility of pipes and standard simple Fortran I/O), take a look at USEROPEN specifier of OPEN statement. It will allow you to OPEN a fortran unit but with a handle that you want -- and that will be an appropriate end of a named pipe (it should be named because it's the simplest way for two processes to open the same pipe, as you cannot share/redirect the handle anymore).
(If you couldn't get the job done with USEROPEN, or it turns out to be too complicated, you can always resort ro ReadFile/WriteFile.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Redirecting of STDIO/STDOUT is just a convenience. In this way, you can use standard Fortran READ(*) and WRITE(*) rather than relatively cumbersome ReadFile/WriteFile. With a "pure" Win32 API solution, you would use ReadFile/WriteFile to communicate through the pipe (as, mostly in the original example). Obviously, you cannot use FORM="Unformatted" or "Binary" on unit *, though.
To get the best of both worlds (flexibility of pipes and standard simple Fortran I/O), take a look at USEROPEN specifier of OPEN statement. It will allow you to OPEN a fortran unit but with a handle that you want -- and that will be an appropriate end of a named pipe (it should be named because it's the simplest way for two processes to open the same pipe, as you cannot share/redirect the handle anymore).
(If you couldn't get the job done with USEROPEN, or it turns out to be too complicated, you can always resort ro ReadFile/WriteFile.)
Thanks for the advice.
It took a while to get right but I have named pipes working in 32 bit.
But the UserOpen function does not resolve during linking when I switch the project to 64 bit platform. I also notice that createFile and createNamedPipe both return 64 bit file handles, yet UserOpen expects a 32 bit handle.
Is the UserOpen option not available for 64 bit IVF?
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm - looks as if we may have overlooked something here. I'll investigate.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page