erratic semantic of loadlibrary

  • 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'.
WHAT?
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.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Call C from MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2013년 9월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by