05-06-2014 03:56 PM
I'm using DAQmx code from a DLL that I developed.
I'm calling this DLL from C++ code.
Everything works good up to a point.
I can read the DAQ, clear it, and reinitialize it.
The crash happens when I close the application.
The fault happens in the function DAQmxGet4322CalAdjustPoints.
I'm not calling this function from my code at all.
There must be a bungled pointer somewhere but i'm pretty sure
that it's not in my code.
Here is a stack trace:
0 nicaiu!DAQmxGet4322CalAdjustPoints C:\Windows\SysWOW64\nicaiu.dll 0x14050619
1 nicaiu!DAQmxUnreserveNetworkDevice C:\Windows\SysWOW64\nicaiu.dll 0x14060977
2 nicaiu!DAQmxSwitchCloseRelays C:\Windows\SysWOW64\nicaiu.dll 0x14060b93
3 ?? C:\Temp\TestDll.dll 0x1373095d
4 TestDll!OpenComPort C:\Temp\TestDll.dll 0x13739f6c
5 ?? C:\Temp\TestDll.dll 0x136b4689
6 ntdll!RtlpNtMakeTemporaryKey C:\Windows\system32\ntdll.dll 0x76ff99a0
7 ?? 0x136b0000
8 ntdll!LdrUnregisterDllNotification C:\Windows\system32\ntdll.dll 0x7700d702
9 ?? C:\Temp\TestDll.dll 0x136b45f0
10 ntdll!TpSetPoolStackInformation C:\Windows\system32\ntdll.dll 0x7700d5a4
11 ?? 0xac2aa0
12 KERNEL32!BasepFreeActivationContextActivationBlock C:\Windows\syswow64\kernel32.dll 0x755e79c5
13 ??
Solved! Go to Solution.
05-07-2014 09:36 AM
Hi WayneS1324,
The function DAQmxGet4322CalAdjustPoints is a low level DAQmx function that is called by higher level functions:
http://zone.ni.com/reference/en-XX/help/370471Y-01/daqmxcfunc/daqmxget4322caladjustpoints/
What sort of functionality does your DLL include? Are you calibrating your DAQ device? Reading from or writing to the device? What DAQ device are you using?
Can you expand on what you mean by crash? Do you get an error message? Does the development environment close? Also, what development environment are you using?
How are you stopping the application? Are you clicking a stop button or otherwise sending a stop command? Are you exiting out of a running application by closing a window?
05-07-2014 09:58 AM
Thanks for the reply.
What sort of functionality does your DLL include?
I'm reading a voltage using DAQmxReadAnalogF64
Are you calibrating your DAQ device?
No.
Reading from or writing to the device?
Right now just reading. On down the line I will be writing as well.
What DAQ device are you using?
PCIe-6321 connected to an SCB-68
Can you expand on what you mean by crash?
The OS (Windows) sends a segmentation fault (SIGSEGV) causing the app to abnormally terminate.
The fault is caused by the app trying to access memory that doesn't belong to it.
Do you get an error message?
In release mode I get a "(App name) has stopped working" message from Windows 7.
In debug mode I get the segmentation fault and a dissassembly of the DAQmxGet4322CalAdjustPoints function.
Does the development environment close?
No.
Also, what development environment are you using?
I'm using Qt Creator.
How are you stopping the application?
If I exit programatically or via the X in the upper, right of the window... I get the fault either way.
Are you clicking a stop button or otherwise sending a stop command?
No.
Are you exiting out of a running application by closing a window?
If I exit programatically or via the X in the upper, right of the window... I get the fault either way.
As part of the applications exiting process, I'm calling a function in the DLL that calls DAQmxClearTask.
Even if I comment out the DAQmxClearTask, I still get the fault.
05-08-2014 03:57 PM
Hi WayneS1324,
Do you get the segmentation fault if you call the DAQmxClearTask function without closing the application?
05-09-2014 05:56 AM
No. The task seems to clear ok.
05-12-2014 07:55 AM
Can you create a very simple C++ test program that creates a DAQmx task, does a finite read, then closes and clears the DAQmx task? It would be helpful to slim things down to the simplest program that reproduces this issue to better identify what might be causing the issue.
Can you describe the exiting process a little further? Do you call only the DAQmxClearTask function, or do you call other functions as well?
05-12-2014 08:58 AM
I found the issue.
Normally you don't have to unload a library because it's done automatically on application shutdown.
I dug around a little and found that the library was being unloaded before the DAQ loop stopped.
If I stop the loop and manually unload the dll then the fault doesn't happen.
Thanks for your help Catherine.