ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Type TaskHandle in DAQmx

I'm trying to create a DLL wrapper to access a few of the DAQmxBase functions for a hardware project. I keep getting the error "Cannot convert from 'unsigned long *' to 'unsigned long **'", where I call the function DAQmxBaseCreateTask(taskName, taskHandle). A little research revealed that the header file 'NIDAQmxBase.h' defines the data type 'TaskHandle' as a pointer to unsigned long and 'NIDAQmx.h' does not.
 
NIDAQmxBase:
typedef unsigned long uInt32;
...
typedef uInt32 *TaskHandle;
 
NIDAQmx.h:
typedef unsigned long uInt32;
...
typedef uInt32 TaskHandle;
 
Both header files define the function call as:
 
int32 __CFUNC     DAQmxCreateTask          (const char taskName[], TaskHandle *taskHandle);
Doesn't that result in 'taskHandle' being a pointer to a pointer to unsigned long in 'NIDAQmxBase'? I can get the DLL compiled if I remove the '*' in the function prototype but then it crashed when I run the application. Has anyone hit this wall?
0 Kudos
Message 1 of 4
(4,674 Views)
How interesting! That could ultimately cause some problems on 64-bit systems.

But for your problem, can't you simply use nidaq.h with your dll wrapper, and use the TaskHandle type? Why do you need to know the type of a TaskHandle? Are you trying to call the function with the basic types instead of using TaskHandle?

I would expect this code to compile with either header:

#include "nidaq.h"

...

TaskHandle h;
DAQmxCreateTask("", &h);

The underlying type of h will be different, but the call to DAQmxCreateTask will pass a pointer to whatever a TaskHandle is on either system.

Of course, all this ignores the fact that with DAQmx Base, the call is DAQmxBaseCreateTask().
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 2 of 4
(4,667 Views)
Thanks, John. As an experiment I switched my code to use the NIDAQmx.h & .lib and it just worked! There's something funny about the Base version.
0 Kudos
Message 3 of 4
(4,662 Views)
There are lots of funny things about DAQmx Base!
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
0 Kudos
Message 4 of 4
(4,659 Views)