calllib fails even though it sees function

9 Ansichten (letzte 30 Tage)
Tom Lawson
Tom Lawson am 20 Mär. 2015
Kommentiert: Tom Lawson am 23 Mär. 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 Kommentare
Tom Lawson
Tom Lawson am 23 Mär. 2015
Bearbeitet: Tom Lawson am 23 Mär. 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 am 23 Mär. 2015
I figured it out - simple mistake - didn't have the function calls in quotes.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by