From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL stops when using nidaqmx function

Hello,

I'm trying to build a new dll using daqmx.
When I use examples creating an exe everything works fine. But when I copy the source to a DLL the code won't be executed.

I'm using
MSVC  6.0
DAQmx 8.6
Using MFC

example code: (I got this out of a forum entry)
    #include <NIDAQmx.h>

    #pragma comment( lib, "NIDAQmx.lib" )

...
void CNIDLL::CheckDevice()
{
        int buffersize,n=1;
        //Buffer size datatypes
        int devicetype_buffersize;
        int devicesernum_buffersize;

        //Device Info variable initialization
        char* devicenames= NULL;
        int devicesernum;
        devicenames=(char*)malloc(buffersize);
        //devicenames = (char*)malloc(devicenames, sizeof(char)*buffersize);
        //Get the string of devicenames in the computer
       //Here the compiler will stop in debug mode
        DAQmxGetSystemInfoAttribute(DAQmx_Sys_DevNames,devicenames,buffersize);
        DAQmxGetDevProductCategory("Dev1",&infoValue2);
        DAQmxGetDevProductType("Dev1", &s[0], 512);
}


Maybe I've to include something?

Regards
Helmut

 
0 Kudos
Message 1 of 1
(2,558 Views)