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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

The program works in Debug mode but not in Release mode

Hey, 

I have been working on a program and it works perfectly in the CVI environment during debug mode but when I am using the release mode to run the program(after installation or in the CVI environment) it crashes in a certain function that reads from a CSV file. I have added to the release all the files that I used for the CSV part. When I debug the crush I don't get any clue about the problem. Did anyone encounter this kind of problem?  

0 Kudos
Message 1 of 6
(3,968 Views)

I don't remember any plausible reason for this odd behaviour.

The usual checks in these cases are to verify that there aren't parts of code excluded in release mode or tailored differently between debug and release mode by means of #ifdef _CVI_DEBUG_ clause or BeingDebuggedByCVI () instruction. Check also that all variables are properly initialized before being used: the release mode behaves differently in this respect from the debug mode.

Additionally, if the program crashes is possible that some item is stored in the system log: check with system Event Viewer and verify the informations added by the OS.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(3,952 Views)

I seem to remember that in debug mode variables are initialized automatically while this probably is not the case in release mode - so it might be that in release mode the string contains some strange / unexpected characters - so I would support Robertos suggestion of checking initialization.

Message 3 of 6
(3,946 Views)

I would also suggest to output some meaningful data to the debug console with DebugPrintf() or OutputDebugString() commands, to be trapped by DebugView utility from Microsoft: even in case of program crash, messages trapped by the utility will permit you to examine the data you have printed to the debug console.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 6
(3,925 Views)

Wolfgang: I tried to give you a kudos but it wouldn't let me.

 

Your reply helped me significantly.  I had some serial communication that would work in debug mode but would give me nothing in release mode.  After reading your reply, I added initialization to my char arrays and it works in release.

 

Thank you!!!

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 5 of 6
(1,728 Views)

you are welcome, I am happy I could assist 😊

0 Kudos
Message 6 of 6
(1,650 Views)