Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28434 Discussions

Error opening named pipe from Fortran

Bill_S_
Beginner
693 Views

I am running  Windows 7 and using Intel Fortran (version 11.0.061) in Visual Studio 2010.                                                
I am testing a compiled library of C++ routines that use named pipes to pass data between a data generating program, a fortran program in this case, and the C++ library.       
                                                                                                                                   
To use the library, you run the C++ library setup program that opens named pipes, then waits for input data from the fortran program. 
The fortran program opens the named pipes, and then is able to read and write data.                                                                          
                                                                                                                                   
When I compile and run with Intel fortran (default options) I get the following runtime error in my fortran progam when            
it attempts to open the named pipe file:                                                                                           
   forrt1: severe (9): permission to access file denied, unit 100, file \\.\pipe\EqnData                                           
                                                                                                                                   
If I compile and run with gfortran (default options) from a command window, the same code will open the files and run the program without error.     
                                                                                                                                   
Here's the fortran code:  It's a snippet from the example program that came with the library, but will also run on it's own.       
 (yes, this is the original format of the example program!)                                                                        
Note: The Intel compiled code crashes on the first OPEN statment.                                                                       

      PROGRAM SolverTest                                              
      IMPLICIT NONE                                                   
C Data pipe                                                           
      INTEGER*4 EqnData /100/                                         
C Result pipe                                                         
      INTEGER*4 EqnResult /101/                                       
C Paths for pipes                                                     
      CHARACTER*128 dataname /'\\.\pipe\EqnData'/                     
      CHARACTER*128 resultname /'\\.\pipe\EqnResult'/                 
C Open data and result pipes                                          
      OPEN(UNIT=EqnData, FILE=dataname, ACCESS='STREAM', STATUS='OLD')
      OPEN(EqnResult, FILE=resultname, ACCESS='STREAM', STATUS='OLD') 
C Close pipes                                                         
      CLOSE(EqnResult)                                                
      CLOSE(EqnData)                                                  
      write (*,*) 'end SolverTest'                                    
      END                                                             

Our IT folks are not familiar with named pipes.                   
Could this be something as simple as changing a compile option?
 

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
693 Views

What's the error? Have you tried a more recent compiler/run-time?

I tried this with 17.0.2 and it worked:

      PROGRAM SolverTest           
    use kernel32
      IMPLICIT NONE                                                   
!C Data pipe                                                           
      INTEGER*4 EqnData /100/                                         
!C Result pipe                                                         
      INTEGER*4 EqnResult /101/                                       
!C Paths for pipes                                                     
      CHARACTER*128 dataname /'\\.\pipe\EqnData'/                     
      CHARACTER*128 resultname /'\\.\pipe\EqnResult'/                 
      
      integer(HANDLE) :: pipe1,pipe2
      
      pipe1 = CreateNamedPipe('\\\\.\\pipe\\EqnData'C,PIPE_ACCESS_DUPLEX, &
        0,1,512,512,0,NULL)
      print *,pipe1
      pipe2 = CreateNamedPipe('\\\\.\\pipe\\EqnResult'C,PIPE_ACCESS_DUPLEX, &
        0,1,512,512,0,NULL)
      print *,pipe2

!C Open data and result pipes                                          
      OPEN(UNIT=EqnData, FILE=dataname, ACCESS='STREAM', STATUS='OLD')
      OPEN(EqnResult, FILE=resultname, ACCESS='STREAM', STATUS='OLD') 
!C Close pipes                                                         
      CLOSE(EqnResult)                                                
      CLOSE(EqnData)                                                  
      write (*,*) 'end SolverTest'                                    
      END                     

 

0 Kudos
Bill_S_
Beginner
693 Views

Thanks for the reply.

Someone else also suggested a newer compiler. I was hoping there was an easy explanation or fix with Intel Fortran 11. Still hoping.

I work for a government agency and things move (and update) slowly! I'll  download a trial version of the latest Intel Fortran. Based on your test it should fix this issue. I'll use that info , and other issues we have had with Visual Studio 2010 and Intel Fortran 11, to request an upgrade for our office.

Thanks - I appreciate your response.

Bill

 

 

0 Kudos
Steve_Lionel
Honored Contributor III
693 Views

An alternative you could try, if you are really stuck with that ancient version, is to build the application as linked with the DLL libraries and then install the current redistributables package so you get the newer run-time library. There is no compiler option that will help you here.

0 Kudos
Reply