Driving ifort form a script

Driving ifort form a script

Bild des Benutzers sgeard@cad-schroer.co.uk

I'm currently driving the ifort command from a script (tcl/tk). Although I have it working there are two problems that I'd like to sort out:

  1. I have to run the script from a shortcut (or bat file) that sets up the ifort vars, is it possible to get the environment variables without DOS?
  2. when ifort runs it briefly creates many DOS windows, how should I invoke the ifort command so that this doesn't happen? The problem seems to be being caused by fortcom.exe.

Thanks,

Simon

4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Steve Lionel (Intel)

I'm not sure what you mean by "without DOS" since there is no DOS. If you're using a command script, it needs to run in an environment where the ifortvars.bat has been called. You could manually add them to the system PATH, INCLUDE and LIB variables, but I don't recommend this.

If the compiler is run from a non-console window, then Windows will create a console window for its output. You can redirect that output elsewhere.

Steve
Bild des Benutzers sgeard@cad-schroer.co.uk

I now have a solution to this problem courtesy of Arjen Markus on comp.lang.tcl . His solution is to write the compile command to a .bat file and then execute that file (rather than running the compiler directly). This works - no more annoying windows. FYI my script now uses

[tcl]

        proc buildExe {args} {
            variable copts
            
            # Create a temporary .bat file
            set of [lindex $args 0]
            set bfile "build_${of}.bat"
            set fh [open $bfile w]
            puts $fh "ifort $copts /Fe$of.exe [lrange $args 1 end]"
            close $fh
            
            # Run the build
            set haveError [catch {eval exec -- $bfile} res]
            file delete -- $bfile
            if {$haveError} {
                return -code error $res
            }
            return $res
        }
[/tcl]

Simon

Bild des Benutzers sgeard@cad-schroer.co.uk

It seems there is no syntax highlighting for tcl, any chance of adding support for it?

Thanks,  Simon

Melden Sie sich an, um einen Kommentar zu hinterlassen.