|
Is there some problem with "&" operator and mex compiler? It try to compile for example the following (test.c):
----------------------------------------------------------------------------------------------------
#include "mex.h"
void add_them(double &k,double x, double y)
{
k=x+y;
}
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
double x,y,k;
// get the inputs
x=mxGetScalar(prhs[0]);
y=mxGetScalar(prhs[1]);
// call the function
add_them(k,x,y);
//create the output
plhs[0]=mxCreateDoubleScalar(k);
return;
}
------------------------------------------------------------------------------------------------------
and I get:
>>mex test.c
Error test.c: 3 syntax error; found `&' expecting `)'
Error test.c: 3 skipping `&' `k' `,'
Error test.c: 3 missing name for parameter 1 to function `add_them'
Error test.c: 3 syntax error; found `double' expecting `{'
Error test.c: 3 missing identifier
Error test.c: 3 syntax error; found `double' expecting `;'
Error test.c: 3 syntax error; found `)' expecting `;'
Error test.c: 3 skipping `)' `{'
Error test.c: 5 undeclared identifier `k'
Warning test.c: 3 possible usage of y before definition
Warning test.c: 3 possible usage of x before definition
Error test.c: 20 too many arguments to `add_them'
Error test.c: 20 too many arguments to `add_them'
Warning test.c: 12 possible usage of k before definition
11 errors, 3 warnings
------------------------------------------------------------------------------------------------------------------------
Thank you for your time
|