Using SmallEiffel under Win32 with Microsoft C

(This document started out when SmallEiffel had no garbage collector and was less easy to use under Windows than it is nowadays. This updated version may still be useful but does not contain anything exciting.)

A binary package of the compiler is now available, including the free LCC/Win32 C compiler.

This document details a quick and dirty port of SmallEiffel to the WIN32 platform using Microsoft's command line C compiler (from Visual C++).

This is followed by the description of some changes necessary to make SmallEiffel's kernel library more standard-compliant (these changes are independent of the environment used).

Contents

Installing SmallEiffel

Setting up the environment

  1. Set SMALLEIFFEL to appropriate base directory (eg "c:\smalleiffel\")
  2. Change PATH to include directory where the SmallEiffel binaries will be.

Example sevars.cmd:

@echo off
echo Setup SmallEiffel environment
set SmallEiffel=c:\smalleiffel\sys\system.se
set Include=%SmallEiffel%bin;%Include%

Compiling SmallEiffel

You can either, using the single file versions, simply do "cl file.c" or "cl -Ox file.c" for every SmallEiffel program, or, using the multiple file versions, "cl -Ox -Fecompile_to_c.exe compile_to_c*" (be careful not do do that on compile*.c as this would match both compile and compile_to_c).

Here is a simple batch to do all that automatically (to be run in %SMALLEIFFEL%/bin_c):

cl -Ox -Feclean.exe clean.c
cl -Ox -Fefinder.exe finder.c
cl -Ox -Fecompile.exe compile.c
cl -Ox -Fprint_jvm_class.exe print_jvm_class.c
cl -Ox -Fecompile_to_c.exe compile_to_c*.c
cl -Ox -Fecompile_to_jvm.exe compile_to_jvm*.c
cl -Ox -Fepretty.exe pretty*.c
cl -Ox -Feshort.exe short*.c
del *.obj

Setup using system.se

It is now possible to run SmallEiffel with Microsoft C using the setup files in the system directory. Also note that Cygnus has made available a port of GNU C to Win32 with which SmallEiffel can be used. LCC/Win32 a port to Win32 of the LCC compiler, which is small and compiles quickly, is also available.

The following configuration files can be used for Microsoft C:

File o_suffix.Windows:
.obj
File compiler.Windows:
cl
File linker.Windows (console applications):
link -out:se.exe
File linker.Windows (GUI applications):
link -out:se.exe -subsystem:windows kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib winmm.lib wsock32.lib

In the case of GUI applications, if the windowing library does not have a WinMain driver that calls SmallEiffel's main, an additional flag -entry:mainCRTStartup is necessary so that main() is called (WinMain being called for GUI application is only a convention, it does not do anything special on the Win32 platform, as opposed to 16 bit Windows implementations).

The Microsoft linker will issue a warning if the program uses floating point maths as SmallEiffel assumes a Unix-style compiler and so adds a -lm to the linker command line.

Standardisation of the Kernel library

The following modifications to SmallEiffel's kernel (in /lib_std) may be useful to make it more compatible with other compilers. This is not going to make the kernel completely standard, but is a starting point dealing with the most obvious problems.


top | SmallEiffel | Franck Arnaud | last updated 19990207