Supported Executable Types
5-27
This example uses several functions from the toolbox\matlab\timefun
directory (weekday, date, tic, calendar, toc) to create a C++ library called
libtimefun.The-W lib:libtimefun -L Cpp options produce the C++ library
files shown in this table.
Note On some platforms, including Microsoft Windows NT, support for C++
shared libraries is limited and the C++ mangled function names must be
exported. Refer to your vendor-supplied documentation for details on creating
C++ shared libraries.
libtimefun.cpp
The C++ wrapper file (libtimefun.cpp) initializes the state of
Compiler-ge nerated f unct io ns so that those functions ca n be called from C++
code not generated by the Compiler. These files are produced from t he
command
mcc -W lib:libtimefun -L Cpp weekday date tic calendar toc
Porting Generated Code to a Different Platform
The code generated by the MATLAB Compiler is portable among platforms.
However,ifyoubuildanexecutable from
foo.m ona PCrunningWindows,that
same file will not run on a UNIX system.
For example, you cannot simply copy
foo.mex (where the mex extension varies
by platform) from a PC to a Sun system and expect the code to work, because
binary formats are different on different platforms (all supported executable
typesarebinary). However,youcouldcopyeither all of the generatedCcode or
foo.m fromthePCtotheSunsystem.Then,ontheSunplatformyoucoulduse
mex or mcc to produce a foo.mex thatwouldworkontheSunsystem.
File Description
libtimefun.cpp
C++ w rapper file
libtimefun.hpp
C++ header file
Comments to this Manuals