Calling Fortran executables from REALBASIC (REALbasic getting started Mailinglist archive)
Back to the thread list
Previous thread: convert image to rtf hex
Next thread: Adding a CHECK MARK in a Listbox
| RB Database - tom.russell transport.alstom.com | ||
| Calling Fortran executables from REALBASIC - Jan Theron | ||
| Re: Calling Fortran executables from REALBASIC - Ken Mankoff | ||
| Calling Fortran executables from REALBASIC |
| Date: 12.03.06 22:54 (Sun, 12 Mar 2006 14:54:56 -0700) |
| From: Jan Theron |
|
Readers
Does anyone have experience with combining REALbasic GUIs with executables made with a Fortran compiler? What is the most elegant way to call Fortran-made executables from within REALBASIC? I have been using the mode (synchronous) shell.execute command. However, I find it very limiting. I do not want the user to see any UNIX, so the idea to to hide all system and other calls behind buttons. Interactive shell mode is available only in OSX, so that rules that out... For example, say my executable is in directory A and the input file needed by the executable in Directory B while I want the out saved to Directory B (to make it easy). How would one implement that? See below what I did when everything is in the same directory: ************ Dim makegrd As Shell Dim errmess,workdir,executable As String makegrdw Shell makegrd.Mode workdireVolumes/SRC/fortran/k_surf_new/" executable Volumes/SRC/fortran/k_surf_new/a.out" makegrd.Execute("cd"+""+" "+""+workdir+";"+" "+executable) errmess^kegrd.Result MsgBox errmess if errmess4 then MsgBox "No output messages" If makegrd.errorCode then MsgBox "Grid has been created" end if else MsgBox errmess end if *********** I am happy with this result so far, but how does one call a series of system commands, such as rlogin node1 cd dir/a nohup ./runit & exit without hardcoding it into a shell script and calling the script? Dr. Johannes N. Theron _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| Re: Calling Fortran executables from REALBASIC |
| Date: 15.03.06 21:07 (Wed, 15 Mar 2006 15:07:03 -0500) |
| From: Ken Mankoff |
|
On 3/12/06, Jan Theron <<email address removed>> wrote:
> > Readers > > Does anyone have experience with combining REALbasic GUIs with executables > made with a Fortran compiler? > > What is the most elegant way to call Fortran-made executables from within > REALBASIC? I have been using the mode=0 (synchronous) shell.executecommand. > However, I find it very limiting. I do not want the user to see any UNIX, > so > the idea to to hide all system and other calls behind buttons. Interactive > shell mode is available only in OSX, so that rules that out... > > For example, say my executable is in directory A and the input file needed > by the executable in Directory B while I want the out saved to Directory B > (to make it easy). > > How would one implement that? > > See below what I did when everything is in the same directory: > > ************ > > Dim makegrd As Shell > Dim errmess,workdir,executable As String > makegrd=New Shell > makegrd.Mode=0 > > workdir="/Volumes/SRC/fortran/k_surf_new/" > executable="/Volumes/SRC/fortran/k_surf_new/a.out" > > makegrd.Execute("cd"+""+" "+""+workdir+";"+" "+executable) > errmess=makegrd.Result > MsgBox errmess > if errmess="" then > MsgBox "No output messages" > If makegrd.errorCode = 0 then > MsgBox "Grid has been created" > end if > else > MsgBox errmess > end if > > *********** > > I am happy with this result so far, but how does one call a series of > system > commands, such as > > rlogin node1 > cd dir/a > nohup ./runit & > exit > > without hardcoding it into a shell script and calling the script? EdGCM (http://edgcm.columbia.edu) runs a lot of FORTRAN from inside RB. But you see the gory details, it is not hidden. I call shell commands by just appending them and then calling it once: s = "rlogin node1; cd dir/a; nohup ./runit &; exit" shell.execute( s ) You could also write your commands to a shell script from RB then call the script. Now it isn't hardcoded but dynamic. -k. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |