Silverfrost Forums

Welcome to our forums

Calling 64-bit Fortran routine from Excel problem

21 Feb 2022 1:33 #28805

Tried looking in the Forum...but no luck! I'm using FTN95 V8.8 with 64-bit Excel and 32bit Excel on another machine. I have Fortran routines called 'superposition.exe' which is a 32-bit version and 'superposition64.exe' a 64-bit routine. They both run perfectly through a command prompt window but not when I call the 64-bit program from VBA. It seems to be a function of the term waitOnReturn as the program hangs. 32-bit version is fine. While it's 'hanging', if I terminate the routine from Task Manager then it continues quite happily. I wondered if the waitOnReturn is causing the issue with a signal from FTN95 telling Excel it's finished. Any help appreciated. Short VBA code as follows... If InStr(Application.OperatingSystem, '64-bit') Then waitOnReturn = True Application.ScreenUpdating = False Set WshShell = CreateObject('WScript.Shell') WshShell.Run Chr(34) & mydir & '\superposition64.exe' & Chr(34), 0, _ waitOnReturn Else waitOnReturn = True Application.ScreenUpdating = False Set WshShell = CreateObject('WScript.Shell') WshShell.Run Chr(34) & mydir & '\superposition.exe' & Chr(34), 0, _ waitOnReturn End If

21 Feb 2022 2:38 #28806

Interesting update...changing the zero to 1 appears to work ok for the 64-bit version!

Changed WshShell.Run Chr(34) & mydir & '\superposition64.exe' & Chr(34), 0, _ waitOnReturn

to

WshShell.Run Chr(34) & mydir & '\superposition64.exe' & Chr(34), 1, _ waitOnReturn

fixed it! I'm not sure I understand why but ho hum - success.

Please login to reply.