User`s guide

7 Libraries
Writing the Driver Application
Note Due to name mangling in C++, you must compile your driver application
with the same version of your third-party compiler that you use to compile
your C++ shared library.
This e xample uses a C++ v ersio n of the matrixdriver application,
matrixdriver.cpp. In the C++ v ersion, arrays are represented by objects
of the class
mwArray.EverymwArray class object contains a pointer to a
MATLAB array structure. For this reason, the attributes of an
mwArray object
are a superset of the attributes of a MATLAB array. Every MATLAB array
contains information about the size and shape of the array (i.e., the number
of rows, columns, and pages) and either one or two arrays of data. The first
array stores the real part of the array data and the second array s tores the
imaginary part. For arrays with no imaginary part, the second array is not
present. The data in the array is arranged in column-major, rather than
ro w- ma jor, order.
/*=============================== ===============================
*
* MATRIXDRIVER.CPP
* Sample driver code that calls a C++ shared library created
* using MATLAB Compiler. Refer to MATLAB Compiler
* documentation for more information on this
*
* This is the wrapper CPP code to call a shared library created
* using MATLAB Compiler.
*
* Copyright 1984-2005 The MathWorks, Inc.
*
*================================ ============================*/
#ifdef __APPLE_CC__
#include <CoreFoundati on/C oreFoundation.h>
#endif
// Include the library specific header file as generated by the
// MATLAB Compiler
#include "libmatrixp.h "
7-18