Go to the first, previous, next, last section, table of contents.

Multiple-Package Example

Consider a program Foo, which makes use of two custom Modula-3 libraries, LibA and LibB. Let's say that these packages are all located in your personal ~/m3 directory, so you have ~/m3/Foo/src, ~/m3/LibA/src, and ~/m3/LibB/src directories, each with its own collection of modules and an m3makefile.

The library m3makefiles would look something like this:

Interface(PublicModule)
Implementation(PublicModule)
interface(PrivateModule)
implementation(PrivateModule)
Library(LibA)

And the m3makefile for the main program Foo might look like this:

import("libm3")
override(LibA,"../../")  % Path is relative to Foo/src
import("LibA")
override(LibB,"../../")
import("LibB")
implementation(Main)
program(Myprog)

First, you need to compile the two library packages. So, execute the following commands:

Then, m3build the main program Foo, and you're done.


Go to the first, previous, next, last section, table of contents.