Linking

SRC Modula-3 uses a special two-phase linker. You must link Modula-3 programs with m3build.

The first phase of the linker checks that all version stamps are consistent, generates declarations for the runtime type structures, and builds the initialization code from the collection of objects to be linked. The second phases calls the host system's linker to actually link the program.

The information needed by the first phase is generated by the compiler in files ending in .ix and .mx. Libraries containing Modula-3 code must be created using m3build. It will combine the .ix and .mx files for the objects in the library into a new file ending in .ax. The .ix, .mx, and .ax files must reside in the same directory as their corresponding .io, .mo and .a files. If m3build encounters a library without a .ax file, it assumes that the library contains no Modula-3 code.

For every symbol X.Z exported or imported by a module, the compiler generates a version stamp. These stamps are used to ensure that all modules linked into a single program agree on the type of X.Z. The linker will refuse to link programs with inconsistent version stamps.


[Modula-3 home page]

m3-request@src.dec.com
Last modified on Thu Jan  4 11:08:04 PST 1996 by heydon 
     modified on Wed Apr 12 15:28:57 PDT 1995 by kalsow 
     modified on Thu Jan  7 18:40:57 PST 1993 by muller 
Copyright (C) 1992, 1996, Digital Equipment Corporation. All rights reserved.
See the COPYRIGHT for a full description.