User`s guide

Supported Executable Types
5-25
mlib Files
Shared libraries, like libraries, let you compile a common set of functions once
and then compile other M-functions that depend on them without compiling
them again.You accomplish this using
mlib files, which are automatically
generated when you generate the shared library.
Creating an mlib File. When youcreate alibrary wrapper file, you alsogeta .mlib
file with the same base name. For example,
mcc -W lib:libtimefun -L C -t -T link:lib -h weekday date tic calendar toc
creates
libtimefun.c
libtimefun.h
libtimefun.exports
libtimefun.mlib
libtimefun.ext
The last file, libtimefun.ext, is the shared library file for your platform. For
example, on the PC, the shared library is
libtimefun.dll
Using an mlib File. This example us es two function, tic and toc,thatareinthe
shared library. Consider a new function, timer, defined as
function timer
tic
x = fft(1:1000);
toc
Prior to mlib files, if you compiled timer using
mcc -m timer
both tic and toc wouldberecompiledduetotheimplicit-h option included in
the
-m macro. Using mlib files, you would use
mcc -m timer libtimefun.mlib
At compile time, function definitions for tic and toc are located in the
libtimefun.mlib file, indicat ing that all future references to tic and toc
should come from the mlib files’s corresponding shared library. When the