Previous: Using installed libraries with mmc --make, Up: Building with mmc --make [Contents][Index]
Suppose the user wants to link against library ‘mypackage’ without installing the library. The source of the library is stored in the directory ‘<dir>’ and that the library has been properly built using ‘mmc --make libmypackage’. To link against the library, the following options have to be added to ‘mmc’:
mmc … --search-lib-files-dir <dir> \ --init-file <dir>/mypackage.init \ --link-object <dir>/libmypackage.a \ …
Note that the option ‘--ml’ is not used.
You need to make sure the library ‘libmypackage.a’ and the main program were compiled in the same grade.
If you need to experiment with more grades, be sure to build the library in all the grades (building several times using ‘mmc --grade <grade> --make libmypackage’) and use the ‘libmypackage.a’ that is compatible with your main program’s grade:
mmc … --use-grade-subdirs \ --grade <grade> \ --search-lib-files-dir <dir> \ --init-file <dir>/mypackage.init \ --link-object <dir>/Mercury/<grade>/*/Mercury/lib/libmypackage.a \ …