MATLAB: Loading 64-bit National Instruments library in 64-bit Matlab

64-bitdata acquisitionloadlibrarynational instruments

Hi everyone,
I am trying to directly call functions in the National Instruments DAQmx driver in a 64-bit setup via loadlibrary. We have everything working under 32-bit, but when switching to 64-bit things break (the setup is 64-bit Matlab 2011b on 64-bit Win7 with the 64-bit driver installed).
When I try to load the 64 bit DAQ dll ('C:\Windows\SysWOW64\nicaiu.dll') using loadlibrary, I receive the error below (both nicaiu.dll and NIDAQmx.h are copied to a local directory.):
>> [A,W] = loadlibrary(['nicaiu.dll'],'NIDAQmx.h','alias','nidaqmx');
Error using loadlibrary (line 421)
There was an error loading the library "C:\Users\NSL_User\nicaiu.dll"
C:\Users\NSL_User\nicaiu.dll is not a valid Win32 application.
Caused by:
Error using loaddefinedlibrary
C:\Users\NSL_User\nicaiu.dll is not a valid Win32 application.
I have read everything I could find on the web, but am not clear why this doesn't work. I can load the 32-bit library from Matlab, but that leaves me with some type incompatiilities (the libpointer for the task is not recognized when passing it back to the driver).
Insights would be highly appreciated,
Thanks & Best wishes,
Bernhard

Best Answer

The "is not a valid Win32 application" error usually means that you are attempting to load a 32-bit DLL using 64-bit MATLAB. Perhaps there are no 64-bit versions of the NI DLLs available? You can try installing 32-bit MATLAB on your 64-bit machine and see if you are able to load the libraries from that installation.