calllib fails even though it sees function

I used libfunctionsview to view the functions in a library I've loaded.
I see the function that I want to call correctly displayed but when I call it, I get:
Undefined function or variable 'DLL_ValIncrement'.

3 个评论

How exactly are you trying to call this and what arguments are you passing in? Please post a code fragment with the full error message.
Thanks for the response, but I had left for the weekend.
Here is what my Matlab looks like:
Trial>> loadlibrary ('testDLL', 'testDLL')
Warning: Warnings messages were produced while parsing. Check the
functions you intend to use for correctness. Warning text
can be viewed using:
[notfound,warnings]=loadlibrary(...)
> In loadlibrary (line 359)
Trial>> libfunctionsview testDLL_
Trial>> y = calllib('testDLL', DLL_ValIncrement)
Undefined function or variable 'DLL_ValIncrement'.
Here is what the header file looks like:
#include windows.h
#define BYTE unsigned char
#define BOOLEAN unsigned char
#define USHORT unsigned short
#define DOUBLE double
__declspec(dllexport) BOOLEAN DLL_DoNothingFunc(BYTE bVal, USHORT usVal, DOUBLE* dblArray);
__declspec(dllexport) BOOLEAN DLLDoMsg(void);
__declspec(dllexport) BOOLEAN DLL_ValIncrement(void);
and I've attached a screenshot showing the results of the call to
libfunctionsview testDLL
showing that all the functions in the DLL are seen correctly.
The use of [notfound,warnings]=loadlibrary(...)
shows a LOT of warnings (I didn't put them in here), but only ones
related to the Microsoft SDK that I downloaded from a link at the
Matlab website. There were no errors or warnings related to my DLL
which may be why it actually did load and showed the correct definition
of the functions within the DLL.
Just tried the Matlab suppled DLL and get the same problem:
Trial>> calllib('shrlibsample', printExportedDoubleValue, void)
Undefined function or variable 'printExportedDoubleValue'.
I figured it out - simple mistake - didn't have the function calls in quotes.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 C Shared Library Integration 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by