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

Can I catch Fortran RTL errors in C?

rzamudio
Beginner
649 Views

I am calling a fortran function from C++ code in a try/catch block. For certain inputs, I get the following RTL error:

forrtl: severe (64): input conversion error, unit -5, file Internal Formatted Read

I would like to catch this error, and any others, in the C code and print a message like "the Fortran function had an error" to a file.

My code is :

try
{
retval = CHARMM(); // The fortran function
switch (retval) {
case 0: fprintf(stderr, "SUCCESS - Charmm exited with code %i. ", retval);
break;
.....

}
catch ( ... ) // Catch any errors
{
fprintf(stderr,"Charmm caused an exception! ");
}

Right now I am just looking for any exception, but if possible would like more information. This code has been able to catch other error caused by the function, stack overflow for example, but doesn't seem to catch any RTL errors. Is this possible?

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
649 Views
See Jugoslav Dujic's reply to your same post in the Fortran for Windows forum.
0 Kudos
Reply