Skip to content

Compile a Sample

Alban edited this page Aug 18, 2019 · 2 revisions

compile a sample

From command line:-

Go to samples mandelbrot sample and clean it of exes.

cd samples
cd mand
del *.exe
del *.c
del *.obj

Now compile with the x86 compiler..

xc =compile manset.mod
S:\projects\modula-2\samples\mand>xc =compile mandset.mod
XDS Modula-2 v2.40 [x86, v1.51] - build 18.08.2019
Compiling "mandset.mod"
no errors, no warnings, lines  666, time  0.06

The native x86 code compiler is called xc.

You will now have created mandset.obj

You can now make and link it

xc =make mandset.mod
S:\projects\modula-2\samples\mand>xc =make mandset.mod
O2/M2 development system v2.51 TS  (c) 1991-2010 Excelsior, LLC. (build 18.08.2019)
#project is up to date
New "tmp.lnk" is generated using template "S:/projects/xds/XDS/bin/xc.tem"

X2C_usedmem=115824

XDS Link Version 2.11.19 Copyright (c) Excelsior 1995-2008.
No errors, no warnings

You now have mandset.exe

You can run that.

compile using C translation

We just compiled using the native x86 compiler; the process is the same to use the C translation.

Use the xm command instead.

Clear the old file.

del *.exe
del *.c
del *.obj

Compile with xm command

xm =make mandset.mod

The compiler will produce a C file; then use the visual C compiler to make an exe file.

It will be considerably larger (and it seems slower) than the native file produced last time.

However it will work the same; and the concept with ansi C is that it is portable to most operating systems.

Clone this wiki locally