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

6 views (last 30 days)
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

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 4 Jun 2012
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.
  3 Comments
Kaustubha Govind
Kaustubha Govind on 11 Jun 2012
Bernhard: What type would you use for the task handles if you were writing a 64-bit C application (outside of MATLAB) to call into the 64-bit DLLs?
Yue Xiang
Yue Xiang on 13 Mar 2019
The key here is that the 64bit .dll is inside system32. I verified this myself.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!