MATLAB: Are the functions from the dll loaded into MATLAB using LOADLIBRARY unavailable

calllibdllgenericheaderincludepathlibisloadedlibmethodsviewloadlibraryMATLABwindows

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

Best Answer

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.