calllib fails even though it sees function

11 visualizaciones (últimos 30 días)
Tom Lawson
Tom Lawson el 20 de Mzo. de 2015
Comentada: Tom Lawson el 23 de Mzo. de 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 comentarios
Tom Lawson
Tom Lawson el 23 de Mzo. de 2015
Editada: Tom Lawson el 23 de Mzo. de 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 el 23 de Mzo. de 2015
I figured it out - simple mistake - didn't have the function calls in quotes.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre C Shared Library Integration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by