I can’t succesfully load the .h file in the API/MATLAB directory. However, I have no trouble working with the .h file in the API directory, but experience the documented memory leaks and eventually need to reboot the system.
I have matlab version 7.0.0.19920(R14)
This is the version of the .h file in the API/MATLAB directory:
$Rev: 325 $ $Date: 2006-08-07 23:21:07 -0700 (Mon, 07 Aug 2006) $
Here is what matlab returns when I try to open the .h file that is in the API/MATLAB directory (I copied it into the API directory)
[CODE]path(path, 'c:\program files\opal kelly\frontpanel\api');
loadlibrary(‘okFrontPanel’, ‘okFrontPanelDLL.h’);
xid.ptr = calllib(‘okFrontPanel’, ‘okUsbXEM3001v2_Construct’);
[ret, x] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_Open’, xid.ptr, 0);
Warning: The function ‘okFrontPanelDLL_LoadLib’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okFrontPanelDLL_FreeLib’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okCPLL22393_GetReference’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okUsbXEM3005_Construct’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okUsbXEM3005_Destruct’ was not found in the library
In loadlibrary at 218
??? Error using ==> calllib
No method with matching signature.[/CODE]
When I proceed to make a call like
calllib(‘okFrontPanel’, ‘okUsbFrontPanel_UpdateWireOuts’, xid.ptr)
calllib(‘okFrontPanel’, ‘okUsbFrontPanel_GetWireOutValue’, xid.ptr, 32)
I don’t get an error, but the returned value is 512, which is not correct.
When I use the .h file provided in the API directory that causes memory leaks, everything works fine, until the system crashes due to the leaks.
Here’s an example of using the .h file that causes memory leaks.
[CODE]>> path(path, 'c:\program files\opal kelly\frontpanel\api');
loadlibrary(‘okFrontPanel’, ‘okFrontPanelDLL.h’);
xid.ptr = calllib(‘okFrontPanel’, ‘okUsbXEM3001v2_Construct’);
[ret, x] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_Open’, xid.ptr, 0);
Warning: The function ‘okFrontPanelDLL_LoadLib’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okFrontPanelDLL_FreeLib’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okCPLL22393_GetReference’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okUsbXEM3005_Construct’ was not found in the library
In loadlibrary at 218
Warning: The function ‘okUsbXEM3005_Destruct’ was not found in the library
In loadlibrary at 218
calllib(‘okFrontPanel’, ‘okUsbFrontPanel_UpdateWireOuts’, xid.ptr)
calllib(‘okFrontPanel’, ‘okUsbFrontPanel_GetWireOutValue’, xid.ptr, 32)
ans =
15474[/CODE]
15474 is the correct result.
Reid