Problem loading front panel .dll in 64 bit matlab r2010a on windows 7

This doesn’t seem to be a problem with front panel as such, but all the same I can’t use my xem3010 any more until I resolve it.

Using 64-bit MATLAB R2010a on windows 7 I’m having trouble loading the okfrontpaneldll that I previously used successfully on Windows XP with 32-bit matlab R2010a.

The dll is from the installation of frontpanel version 4 (understanding that I need to upgrade in order to work with 64 bit windows), but I get the same problem with the dll from version 3.011, which loaded fine on my old computer.

I followed this advice:

… to set up Visual Studio and the SDK. In MATLAB’s loadlibrary.m it initially failed on line 366:

[res,ccout]=system(preprocess_command);
Where the preprocess_command was:

“%VS90COMNTOOLS%…..\VC\vcvarsall.bat” amd64>nul&cl -nologo -I"C:\Program Files\MATLAB\R2010a\extern\include" -E “C:\Program Files\Opal Kelly\FrontPanelUSB\API\Matlab\okFrontPanelDLL.h” > “okFrontPanelDLL.i”
… because it couldn’t find cl (the c compiler). I got around this by adding its location:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64

… to the windows path. Thereafter it failed on line 384:

[parsemsg, status] = perl(prototypes, preprocfile, ‘-outfile=’ mfile_name],‘-thunkfile=’ thunkfilecname], perlopt{:});
With the following messages:

Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(…)

In loadlibrary at 399
In …
Error loading library intermediate output follows.
The actual error is at the end of this output.


Type ‘okDLLEXPORTvoidDLL_ENTRY’ was not found. Defaulting to type error.
Found on line 123 of input from line 122 of file C:\Program Files\Opal Kelly\FrontPanelUSB\API\Matlab\okFrontPanelDLL.h

… and so on, with one such error for each definition in the header file. The line of the header file to which the above error refers reads:

okDLLEXPORT void DLL_ENTRY okFrontPanelDLL_GetVersion(char *date, char *time);
… so without really understanding what it’s doing, it looks to me like it’s failing to understand the syntax and treating “okDLLEXPORT void DLL_ENTRY” without spaces, as a type definition.

I should note that prior to this point, the preprocessing line created a file called:

okFrontPanelDLL.i

… in a temporary directory, and this is the input to the above perl script. Inside that file, the line on which it’s failing appears to be unchanged.

Any help would be greatly appreciated.
Thanks Sim

Sim–

I’m not sure how the Matlab preprocessor works, but you may want to try to force definition of “_WIN32” at the top of the .h file. If the preprocessor doesn’t define this, it might not pick up the okDLLEXPORT definition.

Another thing Matlab has sometimes had issue with is the “void *” typedef for the three _HANDLE macros. Try defining them as “unsigned long” instead.

It seems that the version of matlab was not compatible with the c compiler I was using. I’ve avoided this problem by reverting to 32-bit versions of matlab and frontpanel.

Sim–

For posterity and the benefit of others that may end up searching this topic on these forums, could you please list the compiler version you were using (that didn’t work) and the Matlab and compiler version you are using now (that does work) ?

[QUOTE=simbamford;3138]This doesn’t seem to be a problem with front panel as such, but all the same I can’t use my xem3010 any more until I resolve it.

Using 64-bit MATLAB R2010a on windows 7 I’m having trouble loading the okfrontpaneldll that I previously used successfully on Windows XP with 32-bit matlab R2010a.

The dll is from the installation of frontpanel version 4 (understanding that I need to upgrade in order to work with 64 bit windows), but I get the same problem with the dll from version 3.011, which loaded fine on my old computer.

I followed this advice:

… to set up Visual Studio and the SDK. In MATLAB’s loadlibrary.m it initially failed on line 366:

[res,ccout]=system(preprocess_command);
Where the preprocess_command was:

“%VS90COMNTOOLS%…..\VC\vcvarsall.bat” amd64>nul&cl -nologo -I"C:\Program Files\MATLAB\R2010a\extern\include" -E “C:\Program Files\Opal Kelly\FrontPanelUSB\API\Matlab\okFrontPanelDLL.h” > “okFrontPanelDLL.i”
… because it couldn’t find cl (the c compiler). I got around this by adding its location:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64

… to the windows path. Thereafter it failed on line 384:

[parsemsg, status] = perl(prototypes, preprocfile, ‘-outfile=’ mfile_name],‘-thunkfile=’ thunkfilecname], perlopt{:});
With the following messages:

Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(…)

In loadlibrary at 399
In …
Error loading library intermediate output follows.
The actual error is at the end of this output.


Type ‘okDLLEXPORTvoidDLL_ENTRY’ was not found. Defaulting to type error.
Found on line 123 of input from line 122 of file C:\Program Files\Opal Kelly\FrontPanelUSB\API\Matlab\okFrontPanelDLL.h

… and so on, with one such error for each definition in the header file. The line of the header file to which the above error refers reads:

okDLLEXPORT void DLL_ENTRY okFrontPanelDLL_GetVersion(char *date, char *time);
… so without really understanding what it’s doing, it looks to me like it’s failing to understand the syntax and treating “okDLLEXPORT void DLL_ENTRY” without spaces, as a type definition.

I should note that prior to this point, the preprocessing line created a file called:

okFrontPanelDLL.i

… in a temporary directory, and this is the input to the above perl script. Inside that file, the line on which it’s failing appears to be unchanged.

Any help would be greatly appreciated.
Thanks Sim[/QUOTE]

Hi,
I come across problems with loading lib into matlab. I am using matlab2011ra with MEX3050 board.
You said you made it work under windows xp.
Can you post your code here? or send to my email: [email protected]
Here is the error in matlab:
lcc preprocessor error: D:..\okFrontPanelDLL.h:17 Could not find included file .
Some one can help? Thanks very much.

… so I think the problem was that Matlab R2010a 64-bit only supports the compilers in the Pro editions of Microsoft Visual C++. Reverting to Matlab R2010a 32-bit meant that the free versions of the compilers work for loadlibrary.

Regarding shenhe’s request for code, I’ve put this in a parallel thread.