Why are the functions from the dll loaded into MATLAB using LOADLIBRARY unavailable?

6 次查看(过去 30 天)
I am attempting to use LOADLIBRARY from the MATLAB Interface to Shared Libraries (i.e. GenericDLLs) to access a .dll file in MATLAB. It appears that I have successfully loaded the library into MATLAB, except for some warning messages.
The code below demonstrates the loading of my Windows dll:
loadlibrary('FOO.dll','C:/MyD/Libraries/FOO_Prototypes.h','includepath','C:/MyD/Libraries/')
After loading the dll into MATLAB, I receive the following warning messages:
Warning: The data type 'error' used by function VPX_InsertMessageRequest does not exist
(Type "warning off MATLAB:loadlibrary:typenotfound" to suppress this warning.)
Warning: The data type 'error' used by function VPX_InsertMessageRequest does not exist
(Type "warning off MATLAB:loadlibrary:typenotfound" to suppress this warning.)...
I verified that the dll is loaded into MATLAB by using the LIBISLOADED function:
libisloaded('FOO')
However, when I attempt to view the functions in the DLL with LIBMETHODSVIEW, I receive an error:
libmethodsview('FOO')
??? Error using ==> libmethodsview
No class lib.FOO can be located or no methods for class lib.FOO

采纳的回答

MathWorks Support Team
The problem of the dll functions not being available within MATLAB can be attributed to a number of things:
1. The improper use of
__declspec(dllexport)
This should be
__declspec(dllimport)
Or, you can avoid using the keyword entirely.
2. There is a bug in the LOADLIBRARY tool that causes a failure when multiple variables are declared on a line in a struct definition.
3. Avoid using variables or typedef names that begin with native C data types.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call C from MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by