Next: , Up: Building with mmc --make   [Contents][Index]

6.2.1 Building and installing libraries with mmc –make

To build a library from the source ‘mypackage.m’ (and other included modules), run ‘mmc’ with the following arguments:

mmc --make libmypackage

mmc’ will create static (non-shared) object libraries and, on most platforms, shared object libraries; however, we do not yet support the creation of dynamic link libraries (DLLs) on Windows. Use the ‘mmc’ option ‘--lib-linkage’ to specify which versions of the library should be created: ‘shared’ or ‘static’. The ‘--lib-linkage’ option can be specified multiple times. In our example, the files ‘libmypackage.a’ and ‘’ should appear in the current directory.

Other programs can more easily use a library that is installed. To install the library, issue the following command:

mmc --make --install-prefix <dir> libmypackage.install

mmc’ will create the directory ‘<dir>/lib/mercury’ and install the library there. The library will be compiled in all valid grades and with all interface files. Because several grades are usually compiled, installing the library can be a lengthy process. You can specify the set of installed grades using the option ‘--no-libgrade’ followed by ‘--libgrade <grade>’ for all grades you wish to install.

If no ‘--install-prefix <dir>’ is specified, the library will be installed in the standard location, next to the Mercury standard library.