Hi LDP,
Thanks so much for your comments. I looked around some more and if I add "_stdcall" to the function pointer definition, it works!
typedef int (_stdcall *DLLFUNCTION)(const char deviceName[]);
Admittedly I don't understand why, but the program doesn't crash with the calls to both DAQmxGetDevProductType() and DAQmxResetDevice(). So I'm going to go through and see if I can use function pointers for the rest of the DAQmx functions and hopefully it will work...I was also having trouble converting my NIDSA code, so hopefully this will solve that problem, too....
But to answer your questions --
1) I also tried calling DAQmxGetDevProductType and the same type of behavior occurs.
2) I'm passing "Dev1". This matches the name configured in Measurement & Automation.
3) If I link statically to the library it works. But I'm trying to support 2 different devices - NI4551 and NI4461 -- that use different libraries (NIDSA/traditional NIDAQ and NIDAQmx) in the same application. Only 1 device type would be used on a single PC and the device type would be in a configuration file. I would like not to require the NIDSA, traditional NIDAQ, and NIDAQmx to be installed when not all are used.
4) The debug error was :
Debug Error!
Program c:\eng\twang
Module:
File :i386/chkesp.c
Line: 42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
Message Edited by NF1 on
06-09-2008 06:18 PM