Error using MATLAB "loadlibrary" function

41 views (last 30 days)
I am trying to load the NI DAQmx library "nicaiu.dll" and the associated header "nidaqmx.h" in MATLAB as given below:-
loadlibrary('nicaiu.dll','nidaqmx.h','alias','ni');
Please note that nicaiu.dll is 32-bit and along with nidaqmx.h reside in the current MATLAB(again 32-bit) folder. I am getting the following error:-
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 344
Error using loadlibrary (line 419)
There was an error loading the library "C:\Documents and Settings\rendtest\My Documents\MATLAB\nicaiu.dll"
A dynamic link library (DLL) initialization routine failed.
Caused by:
Error using loaddefinedlibrary
A dynamic link library (DLL) initialization routine failed.
What am I doing wrong?

Accepted Answer

Arun
Arun on 10 Jul 2013
After some research about dependencies of nicaiu.dll, I discovered that all the dependencies of the dll file must be solved for it to be loaded correctly. So, I had to point this to its original location (C:\Windows\System32) to solve this problem! So my loadlibrary call would look like:-
loadlibrary('C:\windows\system32\nicaiu.dll','nidaqmx.h','alias','ni');
With the above, my problem is resolved. Alternatively, there must be some way of adding the above path to the loadlibrary's location-to-look-for-libraries. For now, I shall close this question.

More Answers (0)

Categories

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

Products

Community Treasure Hunt

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

Start Hunting!