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

Get "severe error condition" message

HAMISH
Beginner
901 Views
I am calling a fortran console exe from a .NET application. I can record everything that is written to the standard error and standard output streams, but when the fortran program encounters an unexpected"severe error condition" (like a division by zero) the program crashes, and closesand there is no way of seeing the error. Why is this not sent to the standard error stream? Is there a way to at least keep the console window open, or print the error to a file?

(I need the console window to close if there isn't an error, because it calls the routine several times.)
Also I know how to keep it open if running from the IDE, I need to allow the end user to have a good error message, so we can debug it for them.

Thanks
0 Kudos
4 Replies
IanH
Honored Contributor III
901 Views
You could write a tiny helper console application that calls your fortran console exe and then waits for it to exit. When that helper application detects normal termination of the fortran exe (perhaps through a process return code) it exits (and the console will close), when it detects abnormal termination it stays open until the user presses enter or similar.

Alternatively, perhaps your GUI application could use the Windows API to create a console for your fortran exe to inherit and then carry out similar console closing/leave open actions when the fortran exe terminates.
0 Kudos
HAMISH
Beginner
901 Views
Quoting IanH
You could write a tiny helper console application that calls your fortran console exe and then waits for it to exit. When that helper application detects normal termination of the fortran exe (perhaps through a process return code) it exits (and the console will close), when it detects abnormal termination it stays open until the user presses enter or similar.

Alternatively, perhaps your GUI application could use the Windows API to create a console for your fortran exe to inherit and then carry out similar console closing/leave open actions when the fortran exe terminates.

If I use two fortran console, won't I still lose the error message, or is there a way to keep it?
0 Kudos
JohnNichols
Valued Contributor III
901 Views
I finally started to convert my programs to QuickWin, it has provided a much better environment when compared to console applications. It is not difficult just recomple after creating a new solution. You could try that.

JMN
0 Kudos
HAMISH
Beginner
901 Views

I'm actually trying to switch away from quickwin, for better portability and hopefully some improved performance due to added multitreading optimization.
Though you are right that in quickwin it is not an issue.

0 Kudos
Reply