forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Calling 64-bit Fortran routine from Excel problem

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
Notquitenewton



Joined: 25 May 2021
Posts: 20
Location: England, UK

PostPosted: Mon Feb 21, 2022 2:33 pm    Post subject: Calling 64-bit Fortran routine from Excel problem Reply with quote

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
Back to top
View user's profile Send private message
Notquitenewton



Joined: 25 May 2021
Posts: 20
Location: England, UK

PostPosted: Mon Feb 21, 2022 3:38 pm    Post subject: Calling 64-bit Fortran routine from Excel problem Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group