Win32Ada is an Ada 95 binding for Windows. (Click here to stop reading and go to download). Release 3.0 works with the Microsoft Win32 Application Programming Interface available on Windows NT and Windows 95. Its major features are:

  • direct binding between Ada and C, so programmers' knowledge of the Win32 API can be reused and existing Windows documents and books can be reused;
  • extensive coverage of the Win32 API;
  • good Ada 95 style;
  • extensive online help including Ada help and hyperlinks to the Microsoft help for the C language API;
  • a small but interesting library of sample programs written in Ada 95 which perform Windows functions.
  • Win32Ada has been tested on Intel 486 and Pentium platforms using Windows NT 3.5, Windows NT 3.51, Windows 95, and the following Ada compilers:



    Aonix ObjectAda






    Most testing was done on a Micron 90 MHz Pentium PC running Windows 95.

    At the time of Win32Ada release 3.0 (September 30, 1996) GNAT 3.08W is still an experimental compiler not yet released by ACT. Win32Ada was compiled with this version of GNAT and the build files were modified to work with this version of GNAT, but the sample programs could not be linked and executed.


    Changes from release 2.0 to release 3.0

  • Release 3.0 works with newer versions of GNAT, and with the Thomson/Aonix/Intermetrics compilers
  • Release 3.0 has been restructured to remove dependencies on the C runtime libraries, see below for more details.
  • The pragma c_pass_by_copy was added to many record type declarations.
  • A problem was fixed in the OpenGL bindings where type declarations of 32-bit and 64-bit floating point numbers were incorrect.
  • The FPIEEE_exception_flags type was fixed to conform with Windows NT 4.0.
  • Dependencies on external variables like _HUGE were removed.
  • The declaration of __environ_addr was off by a level of indirection, this has been fixed.
  • The TBUTTON record declaration was fixed.
  • The Stdarg.ArgList type was made into a controlled type, avoiding memory leakage problems.
  • The pragma Linker_Options was removed, because this pragma was not compatible with all compilers.
  • All constants of type Char_Array declared in the binding now have a NUL at the end.
  • The types HRESULT in Win32.Winerror and Win32.Objbase were made honey into one type.
  • The parameter types to ctime, gmtime, and localtime were fixed.
  • Other changes made since release 3.0 are included in the patches directory. See the "readme" file for a list of changes.
  • Changes from release 1.0 to release 2.0

  • New versions of Windows and GNAT were supported.
  • A graphical installation script was added.
  • Other software that is needed with Win32Ada

    A PC with an Intel 486 or Pentium or Pentium Pro running Windows NT or Windows 95 is needed.

    An Ada compiler for Intel and Windows 95/NT is needed, see the above list for the compilers we have used to test Win32Ada.

    To use Win32Ada with one of the Thomson/Aonix or Intermetrics compilers, no other compiler prodct is needed.

    To use Win32Ada with GNAT 3.08W we think no other compiler product is needed.

    To use Win32Ada with GNAT 3.04A the Microsoft Win32 SDK (Software Developer's Kit), which comes with membership in The Microsoft Developer Network, is needed. In addition, some C runtime libraries like those available with Microsoft Visual C++, are needed.

    To uncompress the files in Win32Ada an UNZIP utility is needed. UNZIP is available many places, for example Info-ZIP.

    Downloading and setting up

    Downloading and building Win32Ada takes about 60megabytes of disk space. Building the binding and sample programs takes around an hour on a 90 MHz Pentium. Here are the steps:

  • Download the binding file
  • Check that is correct. We have had some problems with files being corrupted during transfer. The MD5 program computes a 128-bit checksum. MD5 should print d372a54a070e6a6ffa37560c68391d43. Here is a MS-DOS executable MD5 , and a Sun executable MD5 .
  • Unzip
  • Execute SETUP.EXE from the files that were just unzipped.
  • By default Win32Ada is installed in the directory \win32ada, and the rest of these instructions assume that it was installed there.

    Building the binding

    To build Win32Ada with one of the Thomson/Aonix/Intermetrics compilers:

  • Copy the files \win32ada\src\ObjectAda\*.* to \win32ada\src
  • Bring up the Academic AdaMagic or ObjectAda graphical user interface
  • open the project file \win32ada\src\srcProj\srcProj.prj
  • (if you are using Academic AdaMagic) select project->files and include the two files f11bdy and f3bdy into the project, checking the "register as Ada file" box;
  • (if you are using Academic AdaMagic) the project link options are set up for ObjectAda. You will have to change the directory pathnames for the libraries to \academ~1 and add the library \academ~1\apilib\libada_c.lib to each project.
  • adjust the settings in project->settings->link, making sure the pathnames are correct for your system;
  • adjusting project->settings values as desired;
  • project->build withall.exe
  • (Optionally)
  • To build Win32Ada with one of the GNAT compilers:

  • Open a DOS command window.
  • Run the SETPATH.BAT command from the directory where GNAT is installed.
  • \win32ada\setpath (first edit \win32ada\setpath.bat if you are using gnat 3.08)
  • cd \win32ada\src
  • copy gnat\*.*
  • gnatmake withall (ignore error messages at link time)
  • (Optionally)
  • Online help

    The help file \win32ada\win32ada.hlp can be double-clicked, bringing up help for the binding. This help file contains a lot of information on its own, and contains hyperlinks to the Microsoft Win32 API help. The first time you follow one of these hyperlinks it may work, or you may be prompted to browse your disk for the appropriate Microsoft help file.

    The Win32.CRT.* packages

    Win32Ada now has been split into two sections. The Win32 section (138 packages) has no dependencies on Microsoft Visual C++ or any other C or C++ compiler. The CRT section (CRT is an abbreviation for C runtime), comprising the 38 Win32.CRT.* packages, does depend on a set of C runtime libraries like those that come with Microsoft or GNU or another C compiler for Windows.

    In release 3.0 of Win32Ada, the packages that depended on the C runtime have been fully separated from the packages that just depend on the Win32 interface.

    If you want to use the CRT binding to the C runtime, you can compile some or all of the Win32.CRT.* files, and link with a C library from Microsoft or GNU or another source.

    Known bugs

    Win32Ada is based on a version of the Microsoft Win32 API headers which is getting old.

    Many subprograms in the binding have anonymous access parameters, such as

    function GetMessage(lpMsg        : access MSG; 
                        hWnd         : Win32.Windef.HWND; 
                        wMsgFilterMin: Win32.UINT; 
                        wMsgFilterMax: Win32.UINT) return Win32.BOOL

    The lpMsg parameter really should be PMSG, a named pointer type that points to MSG. The difference is that you can't call GetMessage and pass the value null.

    To get around this, if you really need to pass null, redeclare GetMessage with a parameter of type PMSG.

    In recent months there has been a vigorous discussion about whether the various HANDLE types in Win32Ada should be subtypes, or derived types. They were subtypes in version 2.0 and have been left subtypes in version 3.0. The advantage of changing to derived types would be early error detection of certain kinds of errors; the disadvantage would be that the original Microsoft Win32 API is really not designed to be strongly typed and adding strong typing to handles would force programmers to make unnecessary type conversions all over their code.

    Warranty and copyright

    -- A PARTICULAR PURPOSE.  The user assumes the entire risk as to the accuracy 
    -- and the use of this file.  WIN32ADA may be used only by licensees of 
    -- Microsoft Corporation's WIN32 Software Development Kit in accordance with 
    -- the terms of the licensee's End-User License Agreement for Microsoft 
    -- Software for the WIN32 Development Kit.
    -- Copyright (c) Intermetrics, Inc. 1995 (now AverStar)
    -- Portions (c) 1985-1994 Microsoft Corporation with permission.
    -- Microsoft is a registered trademark and Windows and Windows NT are 
    -- trademarks of Microsoft Corporation.


    Development of Win32Ada was funded by the Ada Joint Program Office.

    Win32Ada was developed jointly by Intermetrics (now AverStar) and Labtek.

    Thanks to the people at Aonix for help and support.

    Thanks to the GNAT team at ACT for helping with testing this release and for providing early releases of the GNAT compiler.

    Sending comments and sample programs

    AverStar, Inc. will serve as the clearinghouse for improvements and bug fixes to Win32Ada. LabTek also offers consulting services for GNAT on Windows and for Win32Ada.

    Some quite interesting Ada 95 Windows test programs are included in the SAMPLES directory. More are needed. If you write an interesting sample program that exercises a new part of the Win32 API in Ada, and you want to share that sample with other Ada programmers, please send it to the address below.

    Please send comments and sample programs to:

    S. Tucker Taft
    23Fourth Avenue
    Burlington, MA 01803
    Phone: 781-221-6990 ext. 4509
    FAX: 781-221-6991

    Last updated June 22, 1999.