From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

MatLab error loading nidaq32.lib for PCI-6602 ('not a valid win32 application)

I need to load the library nidaq32.lib for PCI-6602 in a MatLab application which is used for others instruments, but I can't load it and the error is:
 
nidaq32.lib is not a valid Win32 application.
 
Is nidaq32.lib not a Visual C/C++ library?
 
Does exist the nidaq.dll library for Visual C/C++?
MatLab can only load library built on C/C++
 
I have to use MatLab because I have to integrate PCI-6602 in an already existent application.
0 Kudos
Message 1 of 7
(5,122 Views)

The Nidaq32.lib is the static reference library for the nidaq32.dll.

You need to include the nidaq32.dll in your application. This is where the nidaq function calls are implemented.

Nidaq32.dll is used in C/C++ programming, as well as VB or .NET.

I think it is only a matter of what files you are trying to include in your app.

Also, my advice is to make sure you are running the latest version of NI-DAQ Traditional, which is 7.4.1 and is available for download at ni.com/downloads.

Regards,
AlessioD

0 Kudos
Message 2 of 7
(5,116 Views)

Thank you Alessio,

I know that I need to open the nidaq32.dll, but also in the new version of NI-DAQ there is only nidaq32.lib.

Regards
0 Kudos
Message 3 of 7
(5,116 Views)
did you look under Windows\System32\ ?
0 Kudos
Message 4 of 7
(5,111 Views)
Thank you Alessio,
 
I was so convinced to find the dll witihin the directory nidaq\lib\ that I forgot to search in Windows\System32\ ..... I apologize for my stupidity, but it's the first time I use MatLab and NI-DAQ.
 
I've found the nidaq.dll and I tried to open the library, but with no success; the error is the following:
 
Error using ==> loadlibrary
There was an error loading the library "C:\Program Files\MatLab71\Work\PCI-6602\Lib\nidaq32.dll"
Error using ==> loaddefinedlibrary
A dynamic link library (DLL) initialization routine failed.
 
Can you help me?
 
Thank you
 
Regards
0 Kudos
Message 5 of 7
(5,107 Views)

I am not familiar with the way you need to write your M code to reference a DLL in your application.

All I can tell you is that if you are only referencing the DLL without referencing its corresponding .LIB, the compiler does not know what the entry points in the DLL mean and what parameters they use. You need to have both the DLL and the LIB linked to call functions in the DLL.

I suggest you try to reference another DLL and see if you are able to call functions from that DLL.

Regards,

AlessioD

0 Kudos
Message 6 of 7
(5,108 Views)
I retry to load the library after restarting the PC and now  I can see and use the functions of the library... maybe, when I've tried to load the .lib file and MatLab showed me the error, some registers were corrupted. This is the only explanation I can think.
However, thank you for your help.
 
Regards
0 Kudos
Message 7 of 7
(5,102 Views)