User`s guide
Supported Executable Types
5-27
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 uses two functions, tic and toc, that are in the
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 would be recompiled due to the implicit -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, indicating that all future references to tic and toc
should come from the
mlib files’s corresponding shared library. When the
executable is created, it is linked against the shared library. For example, on
the PC, the executable
timer.exe is created and it is linked against
libtimefun.dll.
An advantage of using
mlib files is that the generated code is smaller because
some of the code is now located in the shared library.