What does the error "The function return type is not supported" mean in matlab's calllib?
Am using calllib to access an external DLL from matlab. The DLL has a function in it, with a signature that looks like:
typedef struct resultStruct {
double E;
double W;
double N;
double S;
double Z;
double Y;
} RESULT_STRUCT;
typedef struct inputStruct {
double A;
double B;
double C;
} INPUT_STRUCT;
RESULT_STRUCT calc(
const INPUT_STRUCT* input);
Whe开发者_运维知识库n I try to invoke this in matlab,
loadlibrary('calc.dll','calc.h');
input.A = 1;
input.B = 2;
input.C = 3;
[res, st] = calllib('calc','calc',input);
I get the error:
??? Error using ==> calllib
The function return type is not supported.
Surprisingly, google shows up no hits on that error message, and there is nothing in the documentation for calllib: http://www.mathworks.com/help/techdoc/ref/calllib.html
My guess, is that since the function is returning a structure, matlab is puking. But there's nothing in the documentation to suggest that. Although, none of the examples matlab provides, includes a structure as an output variable.
I suspect the same as you, namely that MATLAB doesn't like a struct return type. Try returning a simple type and see if that works. Then I suggest contacting the excellent MATLAB support people.
精彩评论