User`s guide
Using Wrapper Files
y=0;
You can compile sa mple.m in to a POSIX main applica t io n . If y o u call sample
from MATLAB, you get
sample hello world
ans =
hello
ans =
world
ans =
0
If you compile sample.m and call it from the DOS shell, you get
C:\> sample hello world
ans =
hello
ans =
world
C:\>
The difference between the MATLAB and DOS/UNIX environments is the
handling of the return value. In MATLAB, the return value is handled by
printing its value; in the DOS/UNIX shell, the return value is handled as
the return status code. Wh en you c ompile a function into a POSIX main
application, the return status is set to 0 if the compiled M -file is executed
without errors and is nonzero if there are errors.
C Library Wrapper
The -l option, or its equivalent -W lib:libname, produces a C library
wrapper file. This option produces a shared library from an arbitrary set of
M-files. The generate d header file co ntains a C function declaratio n for each
5-11