Topic: EXP function in dll crashing
I am stuck with a problem I am unable to solve:
- I have a exe which runs wonderfully. It uses a lot of intrinsic mathematical functions such as SQRT, ABS, EXP etc.
- Now I convert the exe to a dll. The dll compiles and links successfully. However, when I use the dll from another executable it would crash. My investigation lead me to the EXP calls. The point is that the call is a legal call with the right argument (the value being passed into EXP has a legitimate answer). When I comment out the EXP calls the program seems to work fine until it crashes due to unreasonable numbers resulting from not calculating EXP. Another thing I did was to add a SQRT just in front of the EXP call where the number passed into SQRT is not permitted (such as SQRT(-2)). IOn this situation the SQRT(-2) is calculated as NaN and program continues until it crashes at EXP.
I am really lost on why the EXP call works in EXE mode but not in DLL mode. While researching about this, I came to know that functions such as SQRT, ABS are calculated inline and functions like EXP requires run time libraries. Is this a reason? If so what run time libraries are needed. My gcc/gfortran is located in the path.
I am using Simply Fortran 1.45 (build 1256)
Any help will be greatly appreciated.
Regards
Sankar
skp