Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Driving ifort form a script

Simon_Geard
New Contributor I
751 Views

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

0 Kudos
3 Replies
Steven_L_Intel1
Employee
751 Views

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.

0 Kudos
Simon_Geard
New Contributor I
751 Views

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

0 Kudos
Simon_Geard
New Contributor I
751 Views

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

Thanks,  Simon

0 Kudos
Reply