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.
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.
12-11-2012 02:00 PM
My LabWindows 2012 CVI application crashes when executing DLL function in Release 64 mode, but not Debug 64 mode. The 64-bit DLL was created in Matlab, and executes Matlab functionality.
The Just In Time debugger comes up right when the DLL function has finished executing. If I link the process to LabWindows I get the following error:
A non-debuggable thread caused a 'General Protection' fault at address
Any ideas?
12-12-2012 04:09 PM
Hi softengr,
I would recommend determining whether this problem occurs because of the difference in speed between the debug and release modes of LabWindows/CVI. To do this, reduce the number of debug options by navigating to Options » Build Options..., and select No run-time checking for the Debugging level. You can also disable some features from the Environment options dialog by unchecking features in the Debug section (Options » Environment...).
You can also try to change the parameters of the Release build by changing parameters in the Build options.
Are you doing any dynamic memory management inside your DLL? Are you able to troubleshoot your DLL to find a specific line which causes this crash?
Any additional information about how you are calling your DLL, whether your DLL calls functions asynchronously, etc. would be very helpful and appreciated.
Warm Regards,
12-13-2012 12:22 PM
The DLL was created in Matlab, and performs an analysis on various input files. The DLL writes output files and displays various plots of data. The input parameters to the function that I am calling are of type "mxArray". I had local mxArray variables declared at the beginning of the thread (the same thread that the DLL function is called in) that were used to pass into the input parameters of the DLL. When I declared these same mxArray variables outside of the thread function, the DLL function no longer crashed. Do you believe the Matlab DLL was doing some kind of dynamic memory management with these mxArray variables when using the mxCreateDoubleScalar function? Could this have been a reason for the crash?
I am going to continue testing to verify that the crash has been eliminated.
12-13-2012 01:42 PM
Hi softengr,
The MathWorks, Inc. provides further documentation about the function in question here. If you have further questions about the workings of your DLL, they may be able to provide more insight.
MATLAB® is a registered trademark of The MathWorks, Inc.
Warm Regards,
12-13-2012 06:43 PM
A bit of a guess here, but have you checked that all your variables are being properly intialized? I seem to recall that in debug variables can be initalized to zero which might be creating nice inputs for your DLL that are not present in release.
12-14-2012 07:14 AM
Yes, the variables that I input into the DLL function have all been initialized. The crash occurs after the DLL performs all of its operations and is ready to return
01-07-2013 10:08 PM
You might want to verify that the setting for EnableLoadExternalModule is the same in both Debug and Release in the Target Settings dialog box. This can get inadvertently changed if the project is opened up and saved in older versions of CVI (especially when CVI 2010 is in the mix)
Good Luck - Jim