Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to DAQmxCreateTask in Microsoft Visual C++ (DLL project)

I'm working on a DLL project in Microsoft Visual C++. This DLL project will call API from USB-6501 hardware. I have another DLL caller (GUI) to call this project during real operation.
Whenever I try to execute "
DAQmxCreateTask("", &handle)" in my c++ code, windows would report "Debug Assertion Failed!" assertion failure. When I ran the code in debug mode, trying to figure out what happened, Windows would tell me that the error might be due to a corruption of heap...
I have no idea what happens because these codes (I created a new exe project and place all USB-6501 related codes there) ran well in a EXE (executable) project!
Please advise.

0 Kudos
Message 1 of 9
(4,836 Views)

Hello fishbone,

What version of DAQmx are you using?  (Version can be found via the Software tab in Measurement & Automation Explorer (MAX))  Does your USB-6501 respond correctly through the Test Panel in MAX?  Do any of the shipping examples give the same error?
(C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C)

These steps are important because they will identify if the driver is installed correctly and your USB-6501 is working properly. 

Are you closing out the session correctly?  If you create a task, then you need to make sure that is closed properly.  (DAQmxClearTask)  The shipping examples should be a great resource for the order in which to call these functions.

Can you take a screenshot of the error and post it to the forum?

Respectfully,

Rob F
Test Engineer
Condition Measurements
National Instruments
0 Kudos
Message 2 of 9
(4,815 Views)
Hi Rob, I'm actually using Microsoft Visual C++ 2005 express edition. When I switched to Microsoft Visual C++ 6.0, everything becomes OK. I've actually posted another question in the forum asking whether DAQmx driver supports express edition from Microsoft. I found another similar thread dated Feb last year saying that DAQmx driver didn't support Microsoft Visual C++ 2005 express edition. Is that still true?
0 Kudos
Message 3 of 9
(4,812 Views)

Hello fishbone,

The DAQmx examples are not going to work on Microsoft Visual C++ 2005 Express Edition.  DAQmx will work with Microsoft Visual C++ 200.  The .NET examples should work with the Express Edition.  The reason that the C++ DAQmx examples will not work with the Express Edition is based on the compiler that is used.  I hope that this information helps.  Let me know if you have any other questions.

Respectfully,

Rob F
Test Engineer
Condition Measurements
National Instruments
0 Kudos
Message 4 of 9
(4,785 Views)
Hi Rob, did you mean "Microsoft Visual C++ 2003"? What about 2008 that is released not long ago? How and where do we find information about compatibility of compiler and NI device driver (not just DAQmx)?
I'm quite surprised and dissapointed that NI DAQmx device driver doesn't work with Microsoft Visual C++ 2005 Express as that is a free software...
Using this software with DAQmx driver would work perfertly some times. But if you compile the code several times without changing any line of the code, you may get heap corruption error message from Windows. At first I thought it might be related to passing of CRT objects cross DLL boundaries but it just didn't work as expected after I tried many ways to try overcome the CRT issues. And then I found a thread mentioning that DAQmx driver doesn't work on Microsoft Visial C++ Express edition...
I just wondering if there are any workarounds?

Thanks.
0 Kudos
Message 5 of 9
(4,771 Views)
Hi Rob, did you mean "Microsoft Visual C++ 2003"? What about 2008 that is released not long ago? How and where do we find information about compatibility of compiler and NI device driver (not just DAQmx)?
I'm quite surprised and dissapointed that NI DAQmx device driver doesn't work with Microsoft Visual C++ 2005 Express as that is a free software...
Using this software with DAQmx driver would work perfertly some times. But if you compile the code several times without changing any line of the code, you may get heap corruption error message from Windows. At first I thought it might be related to passing of CRT objects cross DLL boundaries but it just didn't work as expected after I tried many ways to try overcome the CRT issues. And then I found a thread mentioning that DAQmx driver doesn't work on Microsoft Visial C++ Express edition...
I just wondering if there are any workarounds?

Thanks.
0 Kudos
Message 6 of 9
(4,770 Views)

Hello fishbone,

All of the DAQmx examples are written in MFC.  Microsoft Visual Studio C++ 2005 Express Edition does not support MFC applications. (VS2005 FAQ # 44) The only officially supported version of Visual Studio for DAQmx is 2003 as well as 2005.  We have not fully tested our DAQmx examples in Microsoft Visual Studio C++ 2008 completely.  However, all the examples should work.  I was unable to find out if Visual Studio C++ 2008 Express Edition supports MFC applications.  If it does, then DAQmx should work with that version of Visual Studio.

Respectfully,

Rob F
Test Engineer
Condition Measurements
National Instruments
0 Kudos
Message 7 of 9
(4,754 Views)
Hi Rob, you mention about those DAQmx examples that come with software installation won't work with Microsoft Visual C++ 2005 Express as they are MFC projects. What I'd like to know is that - if I create my own DAQmx project from scratch using MS Visual C++ 2005 Express, does the DAQmx driver work??
0 Kudos
Message 8 of 9
(4,735 Views)

Hello fishbone,

The DAQmx examples will not work with Visual C++ 2005 Express Edition.  However, if you are just making function calls to the dll, then it should work.  We have not tested our driver with that version of Visual Studio. 

Respectfully,

Rob F
Test Engineer
Condition Measurements
National Instruments
0 Kudos
Message 9 of 9
(4,710 Views)