- Create a library foobar.dll and a header file foobar.h .
- Create a directory LL and put foobar.dll in it.
Error using loadlibrary>lFullPath (line 586) Could not find file foobar.h.
That means that MATLAB assumes a header file name when you do not give one. This is undocumented.
- Create script LL/foobar.m .
Undefined function or variable 'foobar_proto'.
loadlibrary foobar foobar
Error using foobar: Too many output arguments.
Apparently, when the header name is not given, the prototype name is assumed to be foobar_proto . However, MATLAB does not try to generate the prototype script, as it ordinarily would, by examining the header file foobar.h , and is happy with reporting an error that the prototype does not exist, even if the header file foobar.h actually exists.
On the other hand, when the header name is explicitly given and it corresponds to a script, the script is assumed to contain the prototype and called accordingly.
What an inconsistent mess.