Loading okFrontPanel.dll in Matlab 64-bit

I had a problem using Matlab 64-bit with FrontPanel and I didn’t find any solution in the forum, other than switching to Matlab 32-bit. So I figured I should post how I solved this.

The error I got when calling loadlibrary(‘okFrontPanel’, ‘okFrontPanelDLL.h’) was “LINK : fatal error LNK1104: cannot open file ‘okFrontPanel.lib’”.
At first, I put the file okFrontPanel.lib in my working directory and in the Matlab search path, but it didn’t work. I found out that the function loadlibrary of the 64-bit version has to create a thunk file and it does so in a temporary folder with no access to the library file. The trick is to disable the temp folder and create the thunk file in your working directory, where okFrontPanel.lib is. This is simply done with the following command: loadlibrary(‘okFrontPanel’, ‘okFrontPanelDLL.h’, ‘notempdir’);

I tested this with FrontPanel v4.4.1, Matlab (R2012b & R2013a) and 2 compilers (Windows SDK 7.1 & Visual C++ 2010 Pro) and it worked great.

Also, it looks like GetFPGAResetProfile and SetFPGAResetProfile are not working, because I got an error when loading the library, so I removed the lines related to these functions from the header file.

Hope this helps.

1 Like