No Matching Signature Error

This error occurs when you call a function without the correct input arguments, or if there is an error in the function signature in the header file.

For example, the function signature for the addStructByRef function in shrlibsample is:

[double, c_structPtr] addStructByRef(c_structPtr)

Load the library.

addpath(fullfile(matlabroot,'extern','examples','shrlib'))
loadlibrary('shrlibsample')

Create a structure, and call addStructByRef.

struct.p1 = 4;
struct.p2 = 7.3;
struct.p3 = -290; 

If you call the function without the input argument, MATLAB® displays the error message.

[res,st] = calllib('shrlibsample','addStructByRef')
Error using calllib
No method with matching signature.

The correct call is:

[res,st] = calllib('shrlibsample','addStructByRef',struct)
Was this topic helpful?