Win32 Programs and Packages

last updated december-19-2001

Jerry's Ada on Win32 Page


Win32 Programs and Packages

A collection of different programs and packages.

Win32 Programs and Packages

  • Glut v3.7 NT port for GNAT 3.13p
  • Experimental GNU resource compiler
  • Lib2Def utility for GNAT 3.13p NT
  • Dll2Def utility for GNAT 3.13p NT
  • A PE format file info utility
  • A Win32 POSIX Binding
  • NT/Win95 Console package
  • A Win32 version of Mike Feldmans SCREEN package
  • A port of AdaSockets to Win32/WinSock 1.1
  • A simple example of using Window Sockets
  • 'Toolhelp' API extension for Win32Ada
  • Using the Win32Ada binding with GNAT
  • NT benchmark scripts and programs

  • Glut v3.7 NT port for GNAT 3.13p

    GLUT is, according to its FAQ:

       GLUT (pronounced like the glut in gluttony) is the OpenGL Utility
       Toolkit, a window system independent toolkit for writing OpenGL
       programs. It implements a simple windowing application programming
       interface (API) for OpenGL. GLUT makes it considerably easier to
       learn about and explore OpenGL programming. GLUT provides a portable
       API so you can write a single OpenGL program that works on both Win32
       PCs and X11 workstations.
    


    Information and documentation on GLUT can be found at the GLUT FAQ

    This binding has the following changes:

    a) Ada binding has been adapted to compile with GNAT v3.13p
    b) Procedures missing in the original binding have been added
    c) The Glut DLL has been rebuild to work properly with GNAT
    d) An GNAT style import library for the GLUT DLL has been added
    e) The Ada redbook examples have been modified to compile with GNAT v3.13p
    f) An example showing the use of menus and fonts has been added
    g) An example showing the use of the new game API has been added
    h) The man pages have been converted to HTML, linked and indexed

    Archive contents:

    binding -> the Glut binding, dll and import library
    docs -> relevant documentation from the original distribution
    html -> man pages converted into html
    example -> some redbook example programs in Ada
    demo -> two additional demonstrations programs

    This binding assumes your system has the Microsoft version of
    OpenGl (opengl32.dll) installed.

    Download Glut v3.7 NT for GNAT 3.13p (270Kb)


    Experimental GNU resource compiler

    windres is the, currently experimental, GNU resource compiler.

    This version has been build for the mingw32 environment, so will work
    'out of the box' with GNAT.

    Download GNU resource compiler (118Kb)

    Although experimental, so far it has worked nicely for me. Two usage notes:

    1. Do not include the windows.h file, since windres does not
       like some of its included files. Instead, try to include
       from the windows include directory, like
       windows/definitions.h.
       If that fails, simply copy the declarations from these
       include files directly into your resource file.
    

    2. To link with GNAT, use the COFF format, like:

    windres myfile.rc myfile.coff gnatmake myfile -largs myfile.coff  


    Lib2Def utility for GNAT 3.13p NT

    The lib2def utility generates a definition file from an DLL import library.
    The advantage of this is, if an import library for a DLL is available, that
    the linkage parameter information is preserved. This means that functions for
    both the 'C' and 'StdCall' convention are properly defined.

    Download Lib2Def utility for GNAT 3.13p NT (7Kb)

    To use the utility, unzip the archive and consult its readme.


    Program to generate .def files from DLL's

    This is the first version of an Ada program that reads a .dll file and writes
    a module definitions (.def) file suitable for use with dlltool to standard output

    A limitation of the current version of dll2def is that it assumes all exports to be
    functions.

    Also it will currently only correctly handle _cdecl type of DLL's.

    Of course, the archive contains the full source code.

    Download .def file generator (40Kb)


    A PE format file info utility

    On Win95/98/NT systems the .exe and .dll files conform to a microsoft defined and
    COFF like Portable Executable format. The fileinfo utility dumps the most
    important information about such a PE format file to standard output.

    The information provided by this utility is useful for finding out a executable files
    memory requirements of for general debugging purposes.

    The archive contains both the source code and a pre-compiled executable.

    Download FileInfo utility (40Kb)


    NT/Win95 Console package

    As NT does not support the standard ANSI escape codes for native applications,
    using the console can be quite a problem. This small package combines and extents
    earlier solutions found here, using the Win32 API.

    Currently it supports: Clearing the screen, Getting/Setting the cursor position,
    Getting/Setting the fore- and background colors and DOS style keyboard input.

    The package does not require a Win32 binding and will work with both GNAT
    (3.13p or higher) and Aonix (v7.1) compilers.

    Download NT/Win95 Console package (8Kb)


    A Win32 version of Mike Feldmans SCREEN package

    A lot of example programs by Mike Feldman use his basic, ANSI based, SCREEN package.
    Unfortunately, MS does not support the use of ANSI escape sequences for Windows
    console programs.

    This archive contains a modified version of the SCREEN package that _does_ work on
    Windows and NT. It schould work with both GNAT and ObjectAda and does not require
    a Win32 binding.

    Download Win32 SCREEN package (3KB)


    A Win32 POSIX Binding

    Pascal Obry did a -partial- POSIX binding for the Win32 (Win95/NT) environment.
    Note that to use this binding you need to have the Win32 binding installed.

    Goto the Win32Ada Posix Binding Page


    A port of AdaSockets to Win32/WinSock 1.1

    AdaSockets now provides for Win32 support natively. An easy to use version
    for windows can be downloaded here. (106Kb)

    The original code can be found here

    Download the original AdaSockets for Win32 (29Kb)


    A simple example of using Window Sockets

    A simple example of using Window Sockets, created after a a question on
    comp.lang.ada. This version is updated to v0.2

    Download Simple winsock example (4.1Kb)


    'Toolhelp' API extension for Win32Ada

    Within the kernel32.dll (Win95 and later, NT 5.0 and later) there is hiding a useful
    toolhelp API. This API is not normally exported, and is not present in the current
    Win32Ada binding.

    The purpose of this API is to take snapshots of the current system status with regard
    to running processes, threads, modules and heap usage. Information that is often useful
    when debugging.

    This small package adds the Win32.Toolhelp binding, and a import library for accessing
    the info, to Win32Ada.

    Note that this code was written specifically for GNAT NT and requires the the Win32
    binding to be installed.

    Download the Toolhelp API (6Kb)

    Note that on NT 4.0 and earlier you need to access the registry to get some of
    this information.


    Using the Win32Ada binding with GNAT

    A simple example of a minimal Win32 program, specifically for the GNAT NT and
    win32ada combination.

    To compile the program, unzip the archive and compile it using 'gnatmake first'.

    Download First W32 GUI program (7Kb)


    NT benchmark script and programs

    This archive contains a number scripts and benchmark programs for doing a basic
    comparison between NT C and Ada compilers. See it's readme for more information.
    These programs were used for my 1999 Ada-Belgium presentation.

    Download Small C/Ada benchmark for Win95/NT (49Kb)

    To use the benchmark, unzip the archive and consult its readme.


    Jerry van Dijk
    jdijk@acm.org

    Copyright © 2001, Jerry van Dijk
    Last Updated december-19-2001