View previous topic :: View next topic |
Author |
Message |
Thomas
Joined: 18 Feb 2005 Posts: 56 Location: Gummersbach, Germany
|
Posted: Tue Dec 13, 2011 7:55 am Post subject: Underfflow within DLL |
|
|
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? _________________ Thomas |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Tue Dec 13, 2011 6:56 pm Post subject: |
|
|
Are you accessing the DLL from an FTN95 executable or from somewhere else? |
|
Back to top |
|
 |
Thomas
Joined: 18 Feb 2005 Posts: 56 Location: Gummersbach, Germany
|
Posted: Wed Dec 14, 2011 7:13 am Post subject: |
|
|
Hi Paul,
The DLL is used with VBA in an MS Excel environment.
Are You interested in an code example? _________________ Thomas |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Dec 14, 2011 8:51 am Post subject: |
|
|
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. |
|
Back to top |
|
 |
|