C API init problems

Hi,

I’m having some very basic problems with the C API. Using the following code always returns -1 in the last call. Using the Python API to do the same thing works fine. Any ideas?

#include <stdio.h> #include "okFrontPanelDLL.h" void main(void) { okFrontPanel_HANDLE ok_handle; int rc = 0; if (FALSE == okFrontPanelDLL_LoadLib(NULL)) { printf("FrontPanel DLL could not be loaded\n"); rc = -1; } if (!rc) { char serial[MAX_SERIALNUMBER_LENGTH+1]; ok_handle = okFrontPanel_Construct(); if (ok_NoError != okFrontPanel_IsOpen(ok_handle)) { printf("Is already open. Closing first\n"); okFrontPanel_Close(ok_handle); } int ec = okFrontPanel_OpenBySerial(ok_handle, serial); if (ec != ok_NoError) { printf("Error %d: Device could not be opened. Is one connected?\n",ec); rc = -2; } } }