Silverfrost Forums

Welcome to our forums

Underfflow within DLL

13 Dec 2011 6:55 #9368

I can use one of my program in 2 different modes: Executable or dll.

Last week I found that execution is different depending on the mode. While the executable could finish without problems, the dll version triggered a run tim error. Reason for the run time error was an underflow condition for a floating point operation.

Example: Double Precision :: x, y x = 1.0d-180 y = x * x ! creates underflow

In both modes the same object file, created with FTN95 without option /UNDERFLOW, is used and linked either to the executable or to the dll.

It took two days of testing until finding the reason, as the error diagnostic for the dll was not specific and did not tell the reason and/or location.

Meanwhile I inserted a call to the routine MASK_UNDERFLOW@ as a 1st executable statement into the code for the dll-version. Now the run time error disappears.

Questions:

  1. Is there a certain reason for different exception handling?
  2. Is the call to MASK_UNDERFLOW@ the preferable method to avoid run time errors when calling routines from a dll?
  3. Can multiple calls to MASK_UNDERFLOW@ cause problems, in the case that the dll-function is used several time?
13 Dec 2011 5:56 #9372

Are you accessing the DLL from an FTN95 executable or from somewhere else?

14 Dec 2011 6:13 #9374

Hi Paul, The DLL is used with VBA in an MS Excel environment. Are You interested in an code example?

14 Dec 2011 7:51 #9376

No, I don't need to see a code sample in this case thanks. My guess is that the default underflow mask is being set in the primary (Excel) environment. Presumably it would work OK if you called the DLL from an FTN95 executable.

Please login to reply.