MATLAB Answers

erratic semantic of loadlibrary

1 view (last 30 days)
Krzysztof on 25 Sep 2013
  • Create a library foobar.dll and a header file foobar.h .
  • Create a directory LL and put foobar.dll in it.
loadlibrary foobar
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 .
loadlibrary foobar
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.

Answers (0)



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!