MATLAB: Mex calls in other mex functions – is it possible

embedded matlabfunction callsfunction declarationsmex

Hello,
Is it possible to have mex-function calls in other mex-functions? if yes, how do I go about it?
I tried to have 2 mex functions f1.c and f2.c; The function f1 has the data initialized and its fed to f2 for addition. But compiling f1 is having issues with the f2 call (unresolved external symbol _f2 in mexFunction – error) as there is no prototype available.
How do I make the declaration for the same?
I know I need to have a header file included with the prototype but I need to know how to write the prototype for the mex-function.
Thanks in advance

Best Answer

Hi,
if the other function is really a mex function, you will need to use the function mexCallMATLAB, which will call then again into the other mex function ...
Or, you rename the function mexFunction in your f2.c and make it a "usual" dll, then you would not need to go through MATLAB.
Titus