I too am having a similar problem with my code. I'm writing a DLL in Visual C++ 6.0 for use with my Borland C++ Builder 5. I've pretty much copied the (working) NI example code line for line when it comes to calling the NIDAQmx functions. While as I said the example works fine (compilied in Visual C++ 6.0) my Borland C++ written program and MS VC++ written DLL produce the error Status Code -50521.
Heres my code:
#include
//#include
//#include
#include "NIDAQmx.h"
#include "WriteDigChan_Fn.h"
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifndef DAQmxErrChk
#define DAQmxErrChk(functionCall) {if (DAQmxFailed(error=(functionCall))) { goto Error; } }
#endif
//...
//...
extern "C"
int __decls
pec(dllexport) WINAPI initDO0()
{
int32 error=0;
TaskHandle taskHandle=0;
uInt8 data[8]={1,0,0,0,0,0,0,0};
char errBuff[2048]={'\0'};
DAQmxErrChk (Configure_WriteDigChan("Dev1/port0/line0:7",&taskHandle));
DAQmxErrChk (Start_WriteDigChan(taskHandle));
DAQmxErrChk (Write_WriteDigChan(taskHandle,data));
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 )
Stop_WriteDigChan(taskHandle);
if( DAQmxFailed(error) )
MessageBox (NULL, errBuff, "DAQmx Error", NULL );
MessageBox (NULL, "Click OK to continue...", "DAQmx DLL", NULL );
return 0;
}
//...
//...
I'm using a PCI 6221 M series
NIDAQ 7.3
Any ideas would be appreciated..
Thanks
Bergen