Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Query if NI-DAQmx is installed

Is it possible to programmatically query if NI-DAQmx is installed?  In our application, some of our customers want to include analog signal input in our software.  However this will be a small minority of our customers.  We don't want to include the NI-DAQ install for everyone.  What would be best is that the customers who want the analog input feature install the NI software with their input device.  Then my software would query if NI is installed and then dynamically link to it. (note, we are using ANSI C - including nidaqmx.h and linking to nidaqmx.lib)

The problem is, linking to nidaqmx.lib requires that the NI-DAQmx dll's be installed.

I'm hoping to avoid using LoadLIbrary and GetProcAddress, as there are a large number of functions to keep track of.  One possibility is if there is a minimal set of DLLs that we can include with our application.  Enough that the application will load, but that don't need the whole install.
0 Kudos
Message 1 of 3
(6,763 Views)
Hi CVilla,

What you wanting to do is often called 'late binding' and Microsoft exposes finding available drivers and functions through LoadLibrary and GetProcAddress. There may be other ways to bind dll's to executables at run time, but certainly the hard way is the best practices way as recommended by Microsoft. Perhaps others here in the community can share what they've done in the past.

The basic algorithm you would need to follow is:

1) See if the driver is available (checking for nicaiu.dll will be sufficient)
2) Bind it
3) Make calls
4) Free it

In pseudo code:

if GetProcAddress(LoadLibrary("nicaiu.dll"), "DAQmxStartTask")
    make_DAQmx_calls();
    FreeLibrary("nicaiu.dll");
else
    do_whatever();

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 2 of 3
(6,740 Views)
I've using LoadLibrary and GetProcAddress and it is working very well.  Thank you very much!
0 Kudos
Message 3 of 3
(6,561 Views)