NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
vincent_lee
Posts: 21
0 Kudos

NI-DAQ 6225 M for LabWindow 6.0

The Document show that DAQmx do not support on Labwindows less than 7.0. Is there solution that I can use library and functions of DAQmx in LabWindow 6.0 development?

Active Participant
Brad_K
Posts: 606

Re: NI-DAQ 6225 M for LabWindow 6.0

Hi Vincent,

 

You should be able to access the DAQmx C API with unsupported compilers by using LoadLibrary("nicaiu") and GetProcAddress(). It's less convenient than using a supported version of LabWindows/CVI, but it should be possible to get it to work.

 

Brad

---
Brad Keryan
NI R&D
Member
vincent_lee
Posts: 21
0 Kudos

Re: NI-DAQ 6225 M for LabWindow 6.0

Brad,

 

Your suggestion might help, but I'm not good at Windows SDK. Do you have precise steps or examples for me to include DAQmx API into my application for LabWindow 6.0.

 

BG,

 

Vincent Lee

Active Participant
Brad_K
Posts: 606

Re: NI-DAQ 6225 M for LabWindow 6.0

[ Edited ]

Hi Vincent,

 

The best solution would be to upgrade to a supported version of LabWindows/CVI. Version 6.0 is over ten years old.

 

If you absolutely must take the unsupported route, the basic idea is to call GetProcAddress for each function you want to use, and cast the resulting function pointers to the correct types:

 

#include <NIDAQmx.h>
#include <windows.h>

int main() {
   HMODULE daqmx = LoadLibraryA("nicaiu");
   if(daqmx) {
      typedef int32 (__CFUNC *DAQmxCreateTaskFnPtr)(const char[], TaskHandle*);
      DAQmxCreateTaskFnPtr daqmxCreateTaskFn = (DAQmxCreateTaskFnPtr) GetProcAddress(daqmx, "DAQmxCreateTask");
      typedef int32 (__CFUNC *DAQmxClearTaskFnPtr)(TaskHandle);
      DAQmxClearTaskFnPtr daqmxClearTaskFn = (DAQmxClearTaskFnPtr) GetProcAddress(daqmx, "DAQmxClearTask");
      if(daqmxCreateTaskFn && daqmxClearTaskFn) {
         TaskHandle task;
         daqmxCreateTaskFn("", &task);
         daqmxClearTaskFn(task);
      }
      FreeLibrary(daqmx);
   }
}

 

This uses NIDAQmx.h for the type and constant definitions, but not the function declarations. Add the corresponding directory (e.g. "C:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\include") to the include path.

 

Note: I tried this code with Visual C++ 2010 but not with LabWindows/CVI 6.0. There may be other incompatibilities between LabWindows/CVI 6.0 and DAQmx that I am not aware of. After all, this combination is unsupported.

 

Brad

---
Brad Keryan
NI R&D
Member
vincent_lee
Posts: 21
0 Kudos

Re: NI-DAQ 6225 M for LabWindow 6.0

Brad,

 

I have to do it in LabWindows 6.0. Thanks for your information. It really help me a lot.

 

Vincent Lee

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page