Still working on my C++ project which has to call Fortran Function :
I use an IEEE_HANDLER in my Fortran Code to catch different exception (here divide by zero).
When a divide by zero occur in my Fortran Code the function in parameter of my IEEE_HANDLER is called.
The problem is, when this function is terminated, I'm unable to continu in my C++ function, even putting a try catch for my Fortran Function.
C++ Code :
catch (const std::exception& e)
printf ("Exception catched
Fortran Code (Extract from Intel documentation) :
SUBROUTINE MyFortranFunction() BIND(C, name="MyFortranFunction")
use,intrinsic :: ISO_C_BINDING
real(C_DOUBLE) :: B
real(C_DOUBLE) :: C
B = 5.0
C = 0.0
B = B/C
print *, 'end of MyFortranFunction'
End Subroutine MyFortranFunction
SUBROUTINE FPE_HANDLER(SIGNO, SIGINFO)
INTEGER(4), INTENT(IN) :: SIGNO, SIGINFO
IR = IEEE_HANDLER('set','division',FPE_HANDLER)
END SUBROUTINE FPE_SETUP
SUBROUTINE FPE_HANDLER(SIG, CODE)
INTEGER SIG, CODE
IF(CODE.EQ.FPE$ZERODIVIDE) PRINT *,'Occurred divide by zero.'
END SUBROUTINE FPE_HANDLER
Trace generated :
Occurred divide by zero.
Do you have any idea about how to continu after an handle of exception in the Fortran Function ?
Thanks in advance