I want to use LOADLIBRARY/CALLLIB to call a library which uses the HWND datatype (from windows.h). In MATLAB versions prior to MATLAB 7.12 (R2011a) this datatype would be interpreted as a voidPtr:
>> loadlibrary('libmy','libmy.h');>> libfunctions('libmy','-full')Functions in library libmy:voidPtr myFun(voidPtr)
In MATLAB 7.12 (R2011a) and newer it is interpreted as HWND__Ptr however:
>> loadlibrary('libmy','libmy.h');>> libfunctions('libmy','-full')Functions in library libmy:HWND__Ptr myFun(HWND__Ptr)
This means that I can no longer do things like:
>> h = calllib('libmy','myFun',0)
??? Error using ==> calllib A structure is required.
Or:
>> libpointer('uint32Ptr',0);>> calllib('libmy','myFun',h)
??? Error using ==> calllib A structure is required.
I also tried the following:
>> libpointer('HWND__Ptr',0);
But that also threw an error:
>> libpointer('HWND__Ptr',0); ??? A structure is required. Error in ==> libpointer at 18ptr=lib.pointer(varargin{:});
Best Answer