I know this question may be slightly off-topic for this board, but I'll ask anyway.
I'm a noob to C++ programming, and I've been trying for a couple of days to implement a NIDAQmx callback in a C++ class.
Is there a way to create multiple instances of a callback method? As far as I can tell, DAQmxRegisterEveryNSamplesEvent will only allow you to pass a static pointer as DAQmxEveryNSamplesEventCallbackPtr.
when using:
class niscope
{
public:
niscope(void);
private:
DAQmxEveryNSamplesEventCallbackPtr callback;
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);
};
niscope::niscope
{
callback = this->EveryNCallback;
}
I get compile errors like this:
error: argument of type ‘int32 (niscope::)(TaskHandle, int32, uInt32,
void*)’ does not match ‘int32 (*)(TaskHandle, int32, uInt32, void*)’
but if I declare EveryNCallback as static it compiles fine, but a static member cannot access other class instances, so it's a catch-22.
Can anyone help?
Thanks,
John