Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issues with EXP function gcc FORTRAN

Status
Not open for further replies.

snkp

Programmer
Sep 6, 2013
2
US
Hello fellow FORTRAN users,

I am having issues with EXP function with gcc FORTRAN compiler (version 4.7). This error manifests only when I create a dll out of the code. When I create an executable there is no issue.

Below is a sample code I have. In this if the argument to EXP function is declared REAL (single precision), then the EXP returns a correct value. However when I change it to Double Precision, then all "hell breaks loose". The EXP function returns garbage.

I read that there is some problem with run time libraries in gcc FORTRAN which is causing issues with EXP function. Is there any way to overcome this issue? Did the new compiler version (4.9, I think) that recently came out fix the issue?

Code:
SUBROUTINE TryDll(Var1,Var2,Var3,Var4)

  !DEC$ ATTRIBUTES DLLEXPORT :: TryDLL
  
  REAL, INTENT(IN) :: Var1
  REAL, INTENT(IN) :: Var2
  REAL             :: ReturnResult
  
  REAL, INTENT(OUT) :: Var3
  REAL, INTENT(OUT) :: Var4
  
  Var3 = Add(Var1,Var2)
  ReturnResult = Subtract(Var1,Var2)
  Var4 = EXP(ReturnResult)

END SUBROUTINE

Any help is greatly appreciated.

Regards
snkp
 
hhhmmm...have you given DEXP a try? Again, though, if your current compiler is having an issue with polymorphism, you should be consistent in both types your variables and expected arguments in functions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top