LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I can't perform test by using execute file created in release model

Hi
 
Can anybody help me.  I developed a test program under LabWndows/CVI. I created the execute file in release model. When I used this exe to test, the popup error message is "Generic Protection". Please tell me how to do. If you have a good solution, please give me a email: yjhyan@hotmail.com, Thanks a lot!
0 Kudos
Message 1 of 6
(3,763 Views)
Can you give us a little more information on this?  A General Protection Fault can be caused by many types of problems.  Does the release executable run on your development system?  Does it generate the same error?  Were you able to run the debug executable on the same system with no errors?  


----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 2 of 6
(3,756 Views)
I am able to run the debug executable on the same system with no errors. The OS is Windows XP,  The Development Environment is CVI 6.0. Once I called the subprogram in my program to perform test, the General Protection Fault was pop-up. This subprogram has a two dimension char array  variable. The size is 320 x 10. If the variable was commentary or shielded, The executable file has no error.  
0 Kudos
Message 3 of 6
(3,740 Views)
My first guess would be that you have done something wrong with a pointer into that array and exceeded one of the dimensions.  In debug mode, memory is initialized to 0.  In release mode, memory is left in whatever state the OS left it in.  You are probably using a string function that expects a null terminated string.  In debug mode, the initialized memory terminates your strings for you.  In release mode, the string function happily zooms along unable to find a null terminator.  Luckily, the OS detects this and tells you. 

There are two ways to find this:
1) Inspect your code line by line.
2) Insert printf statements everywhere to give you hints where the problem is.

If you post the code here, I can see if I can help find it.

----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 4 of 6
(3,712 Views)
Thank you. My friend has solved this problem.  The causation of this fault is that she has used a wrong method to free this two dimension char arry.  The similar codes are as follow:
char **s=NULL
 
s=(char**)malloc(N*sizeof(char));
 
for(i=0;i<N;i++)
{
 
}
0 Kudos
Message 5 of 6
(3,666 Views)
Thank you. My friend has solved this problem.  The causation of this fault is that she has used a wrong method to free this two dimension char arry.  The similar codes are as follow:
char **s=NULL
 
s=(char**)malloc(N*sizeof(char));
 
for(i=0;i<N;i++)
{
  if(s[i])
{
free(s[i]);
}
s[i]=(char*)malloc(M*sizeof(char));
}
.....................
 
free(s);//Use up the memory
0 Kudos
Message 6 of 6
(3,663 Views)