Intercepting Fortran STOP from C++
I prepared a C++ interface to a legacy Fortran library. Some subroutines in the legacy library follow an ugly but usable status code convention to report errors, and I use such status codes to throw a readable exception from my C++ code: it works great. On the other hand, sometimes the legacy library calls STOP (which terminates the program). And it often does it even though the condition is recoverable. I would like to capture this STOP from within C++, and so far I have been unsuccessful. The following code is simple, but exactly represents the problem at hand: The Fortran legacy library