Version stamps

For each interface or module, the compiler generates an object file and a link info file that contains information for the linker. The link info file names the versions stamps imported and exported by the compilation unit.

A version stamp encodes the type and value of a symbol at the time it was compiled. The Modula-3 linker ensures that the version stamps from separately compiled units are equal before linking a program.

Consider the following interface:

    INTERFACE Foo;
    IMPORT Bar;
    CONST A = 4;
    CONST B = Bar.N + 1;
    END Foo.
It exports two version stamps: one for the constant Foo.A, with type INTEGER and value 4, and one for the constant Foo.B, with type INTEGER and value 1 plus the value of Bar.N at the time of the complation. It also imports the version stamp of the constant Bar.N.

In general, the value of a version stamp is independent of the particular expression used to specify the symbol. For example, CONST A=2+2 yields the same version stamp as CONST A=4 or CONST X=3; A=X+1.

Version stamps are produced for each exported symbol in an interface (ie. each type, exception, variable, and procedure). Modules import the version stamps of the symbols that they import.

In -make mode, the compiler only recompiles a source module if its object is missing or if any of its imported version stamps is no longer exported.


[Modula-3 home page]

m3-request@src.dec.com
Last modified on Mon Sep 25 18:31:50 PDT 1995 by heydon
     modified on Thu Apr 21 11:44:17 PDT 1994 by kalsow
     modified on Fri Feb  7 00:38:19 PST 1992 by muller