|
-
April 1st, 1999, 08:50 PM
#1
Program Crash in release mode
hi,
My application crash in release mode,but it work well in debug mode.
I use the socket api in the program.
After i call the function recv(),it crash.
If i don't call recv(),it wrok well.
If the socket api conflict with MFC?
BTW:i already see the some articles in the debug section.
any suggestion?
thanks!
-
April 1st, 1999, 09:13 PM
#2
Re: Program Crash in release mode
Are you sure the crash is caused by recv()? I mean may the problem raise after recv() return, and some other func() is called. In my experience, the release mode version crash often because the bad declaration of message handling function. Say it asks you declare like this
afx_msg void func1()
but if you declare like this
bool func1()
it will work ok under debug mode, but crash immediately in release mode.
Regards
Kevin
-
April 2nd, 1999, 01:08 AM
#3
Re: Program Crash in release mode
If i bypass the recv(),the program worke well.
So i think that is possible the crash.is caused by recv().
The code is:
void CMainFrame::OnProcessPending()
{
// TODO: Add your message handler code here and/or call default
int len, err,lParam;
CString csMsg;
char recvb[MAXBUFFER];
lParam = GetCurrentMessage( )->lParam;
switch ( lParam )
{
case FD_CONNECT:
m_bConnected = TRUE;
SetHandle( FD_READ | FD_CLOSE );
break;
case FD_READ:
recv( m_Socket, recvb, MAXBUFFER, 0) ;
SetHandle( FD_WRITE | FD_CLOSE );
break;
}
}
What's wrong with it?
thanks!
-
April 2nd, 1999, 04:43 AM
#4
Re: Program Crash in release mode
Let me explain what did I mean in the last post.
When you call recv(), if you are working in an none blocking socket(it's default), recv() will return immediately. And when the socket has filled in the buffer, it will notify you (by an event, windows message ,overlappedIO, or complete port, depend on select() option). I just guess the problem is raised in the event or message handler or because of the bad declaration of those handler.
say the correct declaration is
afx_msg LRESULT myHandler()
but by accident, the declaration become
afx_msg void myHandler()
In debug mode, it will raise no problem. but in release mode, it crashs immediately. this is my best guess.
hope helpful
Kevin
-
April 9th, 1999, 01:53 PM
#5
Re: Program Crash in release mode
Maybe its coz of ur project settings.
Enter menu "Build" then "Settings"
then choose only release project
goto "C/C++" and there remove all
optimizations - put it into "Disable(Debug)"
and rebuild all ur project.
sometimes it helps.
WBR Oak
-
April 11th, 1999, 07:26 PM
#6
Re: Program Crash in release mode
Although i already disable the optimization,
it remains crash.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|