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

forrtl: severe (39): error during read

CAO_B_
Beginner
2,083 Views

Hi, 

The aim of my project is to call the subroutines (or functions) of Fortran from Java.

The solutions: I have installed Inter(R) Visual Fortran on Microsoft Visual Studio 2013, and build new project of Dynamic-link Library, and then added the subroutines  written in fortran90. The compiling is successful. After that, copy the *.dll into  the project directory of Java. Finally, use JNA(Java Native Access )to call Fortran from Java.

Some weird behaviours: The calling can't run successful if the subroutines contains input stream of text. The error message is as follows:

---------Visual Fortran run-time error----------------------------------

forrtl:severe(39):error during read, unit -4, file CONIN$

Image                     PC                 Routine        Line    Source

libifcoremd.dll   6D32FA8A  Unknown   Unknown  Unknown

---------------------------------------------------------------------------------

I guess that the reason is some files can't be opened in Fortran subroutines because of the wrong directory.

How can I set the constant work directory in Fortran so that the read-write operation worked in this  directory?

0 Kudos
2 Replies
Arjen_Markus
Honored Contributor I
2,082 Views

No, it is not a file on disk. The name "CONIN$" as well as the negative LU-number reveals the true cause: your program is trying to read from standard input - the console or the keyboard, whatever you prefer.

Look for statements like: read(*,*) ...

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,083 Views

The launching Java application is likely a GUI application... without a console window.

In addition to a READ(*,*), or READ(*,'some format statement here')
you may have a STOP "Some Error Message",
which will then enter a press any key to continue (to abort program).

If you are building a Fortran library that is to be used from a GUI application, then replace all READ(*,... and STOP ... with an appropriate call to a GUI dialog (that you supply).

Jim Dempsey

0 Kudos
Reply