[Icon home]

Icon on Cygwin

Gregg M. Townsend
Department of Computer Science
The University of Arizona

Carl Sturtivant
Computer Science & Engineering Department
University of Minnesota

www.cs.arizona.edu/icon/uguide/cygwin.htm
Last updated June 5, 2013

Introduction

Most contemporary operating systems trace their underlying design to the Unix operating system, as refined and specified today by the POSIX family of standards. Microsoft Windows, however, was developed independently and defines a different set of interfaces for the programmer and the user.

The Cygwin package provides a Unix environment under Microsoft Windows. This allows the latest version of Icon (and many other things) to be built on a Windows system. Successful use of Cygwin requires familiarity with both Windows and Unix.

This document describes some of the peculiarities of the Cygwin port of Icon. These differences are not necessarily identified in other documentation.

Building Icon

Icon is built in a Cygwin shell window using the same process as on on other platforms. The configuration name is cygwin. See the installation documentation for instructions.

The Cygwin package is available from www.cygwin.com. A custom installation of the Cygwin system is required; the default installation provides a bare-bones system insufficient for building software. Icon requires a C compiler and the usual tools and utilities available on a standard POSIX development system; these are found in the gcc-core and make packages.

Additional Cygwin/X packages must also be included in the installation if Icon is to be built with graphics enabled. The necessary packages are detailed at x.cygwin.com.

Running Icon programs

Icon is run by commands entered in a Cygwin terminal window. The simplest command is "icon prog.icn", which runs the program contained in the source file prog.icn. The translator icont can create executable programs from Icon source code. The Unix-style "man pages" for icon and icont describe the command options in a traditionally cryptic manner.

Interpreter path and environment

Icon programs require an interpreter for execution. On Windows, the path of the interpreter is not embedded in an executable program. The program must be able to find iconx.exe in the search path. Icon programs must be run from a Cygwin command shell or xterm window.

The Cygwin/X server must be running, with a correct DISPLAY variable in the environment, to execute graphics programs. The Cygwin installation must therefore include Cygwin/X, in which case the X server may be started from a shortcut or the Start menu in Windows 7, before a command is issued to execute such a graphics program.

Feature test symbols

The symbols _MS_WINDOWS and _CYGWIN are defined by the Icon preprocessor. The symbol _UNIX is not defined. The symbol _GRAPHICS is defined if Icon is built with graphics enabled, as is the symbol _X_WINDOW_SYSTEM. The corresponding strings are produced or omitted, as appropriate, by the &features keyword.

Building dynamic libraries of loadable C code

The Icon function loadfunc allows specially written C code to be loaded and called by an Icon program. See Loading C Functions in Icon.

When building a loadfunc library under Cygwin, link to the import library iconx.a located in the bin directory of the Icon distribution. This allows callbacks to functions in iconx, which happens by default on UNIX-like platforms but not on Windows.