Re: Debug library crashes when linked with Release build
- From: Dave Johansen <davejohansen@xxxxxxxxx>
- Date: Thu, 10 Apr 2008 07:53:02 -0700 (PDT)
On Apr 9, 12:44 pm, Dave Johansen <davejohan...@xxxxxxxxx> wrote:
On Apr 8, 3:45 pm, Dave Johansen <davejohan...@xxxxxxxxx> wrote:
On Apr 8, 3:33 pm, "Ben Voigt [C++ MVP]" <r...@xxxxxxxxxxxxx> wrote:
Dave Johansen wrote:
On Apr 8, 2:52 am, Ismo Salonen <Ismo.Salo...@xxxxxxxxx> wrote:
--snip--
It does no more work because some classes have different sizes in
debug vs. release mode. In debug mode ( _DEBUG defined) the classes
contains extra fields for runtime checks. When release mode is
compiled the classes memory footprint is smaller thanm in debug mode
and debug mode writes memory locaations it should not ( those, now
nonexistent debug variables).
This worked in 2003 because it did not have such sophisticated debug
helpers ( e.g iterator debugging). Using such combination
(debug&release) in same executable was never supported, it worked by
pure luck (or if you *really* knew what to do) .
br
ismo
I think that the claim that it "worked by pure luck" is not correct.
It worked because there's no standard compliant reason why it
shouldn't. I understand that the debug mode now supports more advanced
You can't hide behind the standard here, because you defined _DEBUG, which
begins with underscore+capital letter and as such is reserved for the
compiler or library implementation. When you start messing with reserved
identifiers you are completely implementation-dependent.
Beyond that, the standard requires that the one-definition rule be
respected. Frequently this requires having the same macro definitions
across the whole project, including static libraries, because although ODR
doesn't apply to macros, macros control the definitions of other things.
checks and such, but there's no reason that this couldn't have been
done without maintain existing features (an additional preprocessor
directive that allowed the additional checks to be disable would have
solved the problem). I understand why things broke and the change
makes sense from a certain perspective, but claiming that it "has to
be that way" just isn't true.
I believe there are other macros (why would you need a new directive???)
that control the extra checks.
Dave
I agree 100% and I understand why things are the way they are, but I
still believe that they are this way by choice and not by some
external, uncontrollable force. The versions of Visual Studio prior to
2005 stand as a testament to this, because what I am trying to do was
allowed and functioned properly before Visual Studio 2005. I also
agree 100% that mixing debug and release libraries isn't recommended,
but that doesn't mean that it should be impossible.
Dave
I did a little more digging and it turns out that the iterator
debugging stuff can be disabled (which fixes the problem I was having)
by defining _HAS_ITERATOR_DEBUGGING as 0. You can read more about it
here:http://msdn2.microsoft.com/en-us/library/aa985939(VS.80).aspx
Thanks everyone for all of the help and advice,
Dave
I would like to make a correction and state that turning off the
iterator debugging didn't fix all of the problems that I was having
with mixing debug and release builds, so I guess that this is just a
semi-undocumented breaking change for Visual Studio 2005.
Dave
.
- References:
- Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: David Lowndes
- Re: Debug library crashes when linked with Release build
- From: Ben Voigt [C++ MVP]
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: Ben Voigt [C++ MVP]
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: Ben Voigt [C++ MVP]
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: Ismo Salonen
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: Ben Voigt [C++ MVP]
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Re: Debug library crashes when linked with Release build
- From: Dave Johansen
- Debug library crashes when linked with Release build
- Prev by Date: an application to detect dead pixels of LCD pixel
- Next by Date: Re: an application to detect dead pixels of LCD pixel
- Previous by thread: Re: Debug library crashes when linked with Release build
- Next by thread: Using a static ".lib" file in managed C++
- Index(es):
Relevant Pages
|