From: Manish Khemani on
Hello,

I am calling a dll using calllib. Here is the sample code:
calllib('Library_name','tmain',inp_cmd);

the C++ function header is defined as:
__declspec(dllexport) double tmain(char* s)
{
return x;
}

In the above case I am returning one value. I now have to return multiple values so the C++ function is modified as:
__declspec(dllexport) int tmain(char* s, double*x, double*y)
{
x=a+b;
y=c+d;
}

How does MATLAB support call by reference? How will calllib work in this case? Or is there any other way?

Thanks.
From: Steven Lord on

"Manish Khemani" <khemani_manish(a)yahoo.com> wrote in message
news:hr5399$oaq$1(a)fred.mathworks.com...
> Hello,
>
> I am calling a dll using calllib. Here is the sample code:
> calllib('Library_name','tmain',inp_cmd);
>
> the C++ function header is defined as:
> __declspec(dllexport) double tmain(char* s) {
> return x;
> }
>
> In the above case I am returning one value. I now have to return multiple
> values so the C++ function is modified as:
> __declspec(dllexport) int tmain(char* s, double*x, double*y)
> {
> x=a+b;
> y=c+d;
> }
> How does MATLAB support call by reference? How will calllib work in this
> case? Or is there any other way?

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f42650.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ