FORTRAN STOP leads to exiting Julia REPL

I am wrapping a FORTRAN library that has a bunch of STOP commands in it (to throw errors). However, when I call the library from Julia and one of those errors is reached, the whole process exits (including the Julia REPL). Is this expected? And if so, how can I get around this behavior and simply let an error be thrown on the Julia side of things (try catch doesn’t seem to have effect here)?

Yes it is expected and no there’s basically no way around it. You need to patch those away to report the error in a different way and recompile the FORTRAN library . This is exactly why such code should never be used to report errors in a library, just like abort in C.

4 Likes

Alright, so the fun begins. Thanks for the help!