[Icon home]

Experimental Native Distribution of Icon for Microsoft Windows

Carl Sturtivant
Department of Computer Science & Engineering
University of Minnesota


Current build 0.80, February 14, 2015: download setup-080.exe


An experimental 32-bit build of Icon without graphics for Microsoft Windows version 7 or greater (32 or 64 bits) is now available as a binary distribution only. This build is from the author of this document who will supply improvements from time-to-time. It has been tested on Windows 7 SP1 64-bits and Windows 8.1. It may work on other versions of Windows that are descendents of Windows NT. However, the author has no suitable machines available to determine this.

Unlike the Cygwin distribution for MS Windows which emulates the Linux distribution in its organization and behavior, this distribution is entirely native, and hence is fundamentally dissimilar to Icon on non-Microsoft platforms, paralleling MS Windows' underlying dissimilarity to such platforms. The details of these differences are mostly documented below.

Use of this distribution requires familiarity with the MS Windows Command Prompt or with Windows Powershell, and an understanding of the Windows file system and Environment Variables.


The download consists of a self-contained installer setup-nnn.exe where nnn are the three digits of the build number. The installation can be placed anywhere, and has a suitable default location. Full functionality as described below is provided by making entries in the registry. An uninstaller is provided as a part of the installation process. Installation provides not only icont.exe and iconx.exe and the Icon Program Library (IPL), as well as documentation, but also a samples directory, containing examples that exercise the Windows specific parts of the build. The distribution is fully functional: all optional features of Icon have been implemented for Windows. However the IPL has not been modified to take account of Windows specific differences, and the author will not attempt this. A symbol to test for this native Windows distribution (see below) is useful if you decide to do some of this work. When the IPL is officially updated, the newest version will be incorporated by the author into the latest build of this distribution, and the documentation updated accordingly.

Running Icon programs

An Icon program may be run as usual from the command line. Alternatively, compilation of an Icon program resident in a single .icn source file may be accomplished by right-clicking on the file's icon in Windows Explorer, and selecting icont from the resulting context menu, which opens a console and runs the Icon translator icont. If the compilation is unsuccessful the console remains open when icont.exe completes execution, so error messages may be observed. Otherwise the console immediately closes, and a .icx file containing icode that is associated with the Icon virtual machine iconx.exe is created alongside the source file. An icode file is executable by double-clicking it, or by typing its name with or without the trailing .icx into a command prompt or powershell prompt, the latter requiring only that the icode file is in the current directory or on your Windows Path. Unlike other distributions of Icon, icode files contain no stub loader, only icode, and they are run via Windows' association mechanisms. When an Icon program is run not from a console, it opens its own console. If the program returns with a non-zero return code, by calling exit(1) for example, that console will remain open after execution terminates, otherwise not.

Shell for system Calls and Opening Commands with a Pipe

The shell used by a system call or by reading or writing commands with a pipe is Windows Powershell. If you want the DOSBOX-like behavior of the Windows Command Prompt  then use cmd.exe /C followed by the command of your choice. A shell command may be opened to read or write with a pipe, by use of the "p" option as the second argument to open as is usual. A command may also be opened bidirectionally, both to write to and read from, by using the option "pb". The effect of this is that open suspends two files, one for writing to the command, one for reading from its output. These may be independently used and closed. See the pipeX.icn examples in the samples directory. The author cannot guarantee that all commands will behave well when used like this, but the best behavior can often be obtained by first writing to the command, then closing the file used to write, and then reading from the command using the other file.

Feature Test Symbols

The symbols _MS_WINDOWS and _NATIVE_WINDOWS are defined by the Icon preprocessor. Note that _MS_WINDOWS is defined by the Cygwin distribution but _NATIVE_WINDOWS is not. The corresponding strings are produced by the &features keyword. See features.icn in the samples folder.

Environment Variable Differences

The environment variable IPATH used by icont.exe to define locations to search for library modules to link to is not space or colon separated list of locations as in other distributions, as this is incompatible with the syntax of paths in Windows. Instead it is a semicolon separated list of locations, where spaces are significant as a part of a location.

Building Dynamic Libraries in C, C++ or D Loadable by Icon

The Icon function loadfunc allows specially written C code to be loaded and called by an Icon program. See Loading C Functions in Icon. A dynamic library containing such functions may also implement new Icon datatypes. See External Values. A language that is binary compatible with C may also be used for this purpose, such as C++ or D.

When building a loadfunc library under Windows, link to one of the import libraries located in the bin directory of the distribution. This allows callbacks of functions in iconx.exe, which happens by default on UNIX-like platforms but not on Windows. The samples directory contains a loadfunc directory with machinery to build a working example of a dynamically loadable library with two different compilers, and a program to load and call a function inside it from Icon. See the ipl/packs folder for loadfunc related machinery to extend Icon via dynamic libraries.

Calling Loadfunc

Windows has an efficient mechanism to find an executable or dynamic library on your PATH given only its filename, as a matter of course when attempting to load such a file. The implementation of loadfunc in this distribution therefore will find such a file when its name without a path is supplied as an argument. Use of pathload from io.icn in the program library is therefore unnecessary, and since pathload does not understand the syntax of Windows paths at the time of writing, it should be actively avoided. A dynamic library may be named with suffix .dll as is traditional for Windows or with .so as is traditional for Linux, and this mechanism will work equally well in either case.


There is no icon command to compile and run source because the mechanism to do that on Windows would be to associate Icon source files with icont.exe rather than with a text editor. Profiling, new as of Icon 9.5.1, is not supported. There is no graphics support in this build.