Matlab occasionally crashing using FrontPanel API and DLLs. Version 5.1.0


I am using the latest version of the Opal Kelly dlls (I believe version 5.1.0) to communicate with some boards through Matlab. Currently, I am able to call the API to construct a handle and get the number of devices connected using ‘okFrontPanel_Construct’ and ‘okFrontPanel_GetDeviceCount’.

My issue comes when I try to call ‘okFrontPanel_GetDeviceListSerial’. Matalb usually crashes when calling this function and I am not sure why. Further, there are times when the function does go through successfully and I am able to get a serial number, but then matlab will randomly crash some time afterwards.

Looking through some of the older posts on this forum there seems to historically be issues with getting the header file to cooperate with Matlab 64 bit. Unfortunately those suggestions dont seem applicable to my version of the API as some of the handles referenced in those solutions are defined differently in my header file ‘okFrontPanelDLL.h’. Example below:

Suggested solution:


typedef unsigned long okPLL22150_HANDLE;
typedef unsigned long okPLL22393_HANDLE;
typedef unsigned long okFrontPanel_HANDLE;


typedef long long okPLL22150_HANDLE;
typedef long long okPLL22393_HANDLE;
typedef long long okFrontPanel_HANDLE;

My header file does not have these definitions specifically. Rather, my header file contains

typedef struct okPLL22150Handle* okPLL22150_HANDLE;
typedef struct okPLL22393Handle* okPLL22393_HANDLE;
typedef struct okFrontPanelHandle * okFrontPanel_HANDLE;

Now I have tried changing those definitions to match the suggested solution but the issue still persists. The AP is still able to work in Matlab but I am still crashing at the same function call and also still experiencing random crashes if it does go through. Also note there are times when I get past all of the initialization and opening of the device and am able to use the API for hours without experiencing any issues. I am hoping someone who has had similar problems was able to solve this problem and if they can share their solutions with me.

Thank you.