User`s guide

5 Compiler Commands
Using Wrapper Files
In this section...
“What Are Wrapper Files?” on page 5-10
MainFileWrapper”onpage5-10
“C Library Wrapp er” on page 5 -1 1
“C++ Library Wrapper” on page 5-12
What Are Wrapper Files?
Wrapper files encapsulate, or wrap, the M-files in your application with an
interface that enables the M-files to operate in a given target environment.
To provide the required interface, the wrapper does the following:
Perfor ms wrapper-specific initiali zation and termi n ati on
Provides the dispatching of function calls to the MCR
To specify the ty pe of w rapper to g enerate, use the follow ing syntax:
-W <type>
The following sections detail the available wrapper types.
Main File Wrapper
The -W main option generates wrappers that are suitable for building
standalone applications. These POSIX-compliant main wrappers accept
strings from the POSIX shell and return a status code. They pass these
command-line strings to the M-file function(s) as MATLAB strings. They are
meant to tra nslate “command-like” M -files into POSIX main application s.
POSIX Main Wrapper
Consider this M-file, sample.m.
function y = sample(varargin)
varargin{:}
5-10