User`s guide
Using C/C++ Shared Libraries on M ac OS X
*
*================================ =============================*/
#include <stdio.h>
#ifdef __APPLE_CC__
#include <CoreFoundati on/C oreFoundation.h>
#endif
/* Include the MCR header file and the library specific header
* file as generated by MATLAB Compiler */
#include "libmatrix.h"
/* This function displays double matrix stored in mxArray */
void display(const mxArray* in);
void *run_main(void *x)
{
int *err = x;
mxArray *in1, *in2; /* Define input parameters */
mxArray *out = NULL;/* and output parameters to be passed to
* the library functions */
double data[] = {1,2,3,4,5,6,7,8,9};
/* Call the mclInitializeApplication rou tine . Make sure that
* the application was initialized properly by checking the
* return status. This initialization has to be done before
* calling any MATLAB API's or MATLAB Compiler generated
* shared library functions. */
if( !mclInitializeApp lica tion(NULL,0) )
{
fprintf(stderr, "Coul d not initializ e application.\n");
*err = -1;
return(x);
}
/* Create the input data */
in1 = mxCreateDoubleMatrix(3, 3,mxREAL);
in2 = mxCreateDoubleMatrix(3, 3,mxREAL);
7-33