Intel® Fortran Compiler 17.0 Developer Guide and Reference

Custom Handlers for Fortran DLL Applications

There are two aspects to creating custom handlers for Fortran DLL applications:

Containing Errors and Exceptions in Fortran DLLs

If you are building a Fortran DLL and intend to call it from a main program written in some other language, you want to be careful that errors and exceptions in the DLL do not crash your main application.

Here are a few basic principles to keep in mind if you are building a Fortran DLL:

Enabling Floating-Point Traps in Fortran DLLs

Before you can worry about how you will handle a floating-point trap condition occurring in a DLL, you have to consider the problem of unmasking those traps so they can occur. If you are compiling with fpe[:]3 and polling the floating-point status word to check for exceptions, you do not have to worry about the problem of unmasking traps. You do not want traps unmasked in that case.

If your strategy is to compile with fpe[:]0 and allow traps on floating-point exceptions, you need to take action to unmask the traps in the floating-point control word because most other languages mask traps by default.

Recall that a Fortran Console or Fortran QuickWin (or Standard Graphics) application would have unmasked traps for you automatically because the Fortran run-time system provides the main program and calls your MAIN__ which executes some prolog code before the actual application code starts. You do not have that in a Fortran DLL called by some other language. Different languages establish different initial environments. You must provide the desired initial environment yourself.

See Also