calllib fails even though it sees function

1 view (last 30 days)
Tom Lawson
Tom Lawson on 20 Mar 2015
Commented: Tom Lawson on 23 Mar 2015
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 Comments
Tom Lawson
Tom Lawson on 23 Mar 2015
Edited: Tom Lawson on 23 Mar 2015
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'.
Tom Lawson
Tom Lawson on 23 Mar 2015
I figured it out - simple mistake - didn't have the function calls in quotes.

Sign in to comment.

Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!