Win32 DLL project randomly crashes after moving to VS2005
- From: "Jonathan Potter" <gpsoft@xxxxxxxxxxxxxxxx>
- Date: Mon, 15 May 2006 23:01:33 +1000
I've got a Win32 (no MFC, ATL etc.) DLL project which I recently moved from
VS2003 to VS2005.
Of course, the first step was to take care of the compilation
errors/warnings, mainly due to deprecated functions and the new "secure
CRT", which I simply #defined away for now because much of the code is 3rd
party graphics libraries I don't want to extensively modify. The code now
compiles fine with no errors and no warnings.
The problem is that when I run my DLL it crashes in apparently random places
and in different parts of the project which have very little in common. For
example, I had a crash within a dialog's window procedure and another
similar crash inside library code (also compiled by me in VS2005) which
loads an image.
In the dialog proc's case I was able to "fix" the bug by refactoring my huge
dlgproc into several smaller functions. (I could also "fix" it by commenting
out the lines where the crash occurred but it's interesting to note that the
crash still happened if I changed those lines to send a WM_NULL to the
dialog.) The dialog crashes were occuring around the time of recursive calls
to the dlgproc, and under a debugger the crash in both the dialog and the
image library were generating a "stack overflow" message. But I don't buy
this as the real cause because there are very few functions and very little
data on the stack and the code is not in an infinite loop, worked fine under
VS2003 and indeed works if I refactor the code in a way which ads *more*
call data to the stack, not less. The recursion level is 3 calls deep, if
that.
I sent the code to a friend who has BoundsChecker and he said it couldn't
detect anything wrong with it, but he could still reproduce the crash.
This has been driving me nuts and wasted a lot of my holiday time that I
wanted to spend actually making cool stuff. I wonder if anyone has
experienced anything similar and has suggestions on where to look? It feels
like a compiler error or a stack corruption issue rather than a genuine
stack overflow.
Has anything changed in the way VS2005 deals with the stack? I haven't
touched any project settings after converting from the VS2003 project, but I
read that the default stack size has been increased from 64k to 1meg. Maybe
there's a problem when DLLs are called from non-VS2005 programs and the
VS2005-generated code is assume 1meg of stack has already been reserved or
something? I'm clutching at straws really... (Writing a test harness for the
DLL in VS2005 is on my list of things to try but that list is long, my
holiday is over, and the whole ordeal has left me quite frustrated! So I'm
hoping someone has some good advise.)
Thanks for reading and any help!
Jon
begin 666 smiley_frown.gif
M1TE&.#EA$ `0`+/_`,# P,J/)?'+@Z&;D714#[!Y$NBK.X%Z;/SLSV))'>FZ
M;+*TLI!>!M'*O.F8!&E<02'Y! $`````+ `````0`! ```2$$,C9UFHSSW%>
M2L\Q:-*1$(5A%$1R:&: S$(=$*\T),9,UX;;"/!@S!*#6H'G8#P`BX<,<5#8
M& X':[ 3-*P"A<*0+3@(7 (XK,JZT0."0;SZ8+/"!4I58) 3!0%:"1@'<@9^
C;G<X$E%89&Y93@L;18)N`4Y#$U$G#)\@E"10!QT'HA,1`#L`
`
end
.
- Prev by Date: Re: Runtime LIbrary: Multi-Threaded Only
- Next by Date: Re: vb or c#
- Previous by thread: Runtime LIbrary: Multi-Threaded Only
- Next by thread: Re: vb or c#
- Index(es):
Relevant Pages
|
Loading