473,569 Members | 3,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Yet another debug-to-release issue

How many times have we had a program that works toot-sweet in debug but dies
in release? Too many.

I've created .NET assembly containing a bunch of managed wrapper C++ classes
that wrap unmanged C++ classes; these unmanaged C++ classes are located in a
Win32 library file. The library is built using MFC as shared in debug but
static in release (this is how we typically to things).

The managed wrapper classes do a new on the unmanged class in the
constructor and then have pass through functions to the unmanaged class.

I have a console application that tests the wrapper assembly and all is
heavenly sweet in debug.

In release mode, the heap is corrupted before any lines are executed in the
constructor of any managed wrapper class; it is fine in the test application
right before it does a new on the managed wrapper class. _crtheap is zero in
malloc.c.

Anyone have any ideas?

Thanks.

Jon.
Nov 17 '05 #1
5 1095
I don't know how much this helps but I'm curious what would happen if
MFC library is statically linked in debug mode.

Without seeing any project settings, that seems the only difference
between debug mode and release mode.

Keep us updated.

Ramsey

Nov 17 '05 #2

It looks like CRT is not initialized.

May be here you can find some related information:
http://support.microsoft.com/?id=814472

Regards,
Oleg


Nov 17 '05 #3
I gave this some thought and will probably give this a shot in my next go at
it - Thanks for the reply.

"Ramsey" <ra********@hot mail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I don't know how much this helps but I'm curious what would happen if
MFC library is statically linked in debug mode.

Without seeing any project settings, that seems the only difference
between debug mode and release mode.

Keep us updated.

Ramsey

Nov 17 '05 #4
Looks interesting - might have to give this a try - thanks. Jon.

"Oleg Starodumov" <com-dot-debuginfo-at-oleg> wrote in message
news:ur******** ******@TK2MSFTN GP12.phx.gbl...

It looks like CRT is not initialized.

May be here you can find some related information:
http://support.microsoft.com/?id=814472

Regards,
Oleg



Nov 17 '05 #5
I got everything to play together by setting Use MFC as a Shared DLL and
using /MD throughout on all the components that go into building the .NET
assembly. I'd rather use Use MFC as a Static Library but perhaps creating a
DLL assembly with MFC requires the Shared version of MFC. It seems to work
so I'm moving on. Thanks all for the comments. Jon.

"jlea" <jo*@leapsoft.c om> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I gave this some thought and will probably give this a shot in my next go at it - Thanks for the reply.

"Ramsey" <ra********@hot mail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I don't know how much this helps but I'm curious what would happen if
MFC library is statically linked in debug mode.

Without seeing any project settings, that seems the only difference
between debug mode and release mode.

Keep us updated.

Ramsey


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3485
by: Markus Dehmann | last post by:
I have a static const bool debug = false; variable in my class. Debug output goes like this, trivially: if(debug) cerr << "debug message"; Is it guaranteed that this if/then clause is always optimized away if the debug variable is false? Thanks! Markus
2
1528
by: John A. Bailo | last post by:
When I run this line, Debug.WriteLine("I am in OnHandler2 and MyEventArgs is {0}", e.m_id); and e.m_id = "Event args for event 1" What prints in the debug window is: Event args for event 1: I am in OnHandler1 and MyEventArgs is {0}
1
1848
by: Fred Mellender | last post by:
When I code: Debug.Assert(false, "this is a message"); it works fine, and out comes the dialog box. When I code Trace.Listeners.Clear(); Debug.Assert(false, "this is a message"); No message is output. In the debugger I see that clearing the Trace Listeners clears the Debug
4
4511
by: emma middlebrook | last post by:
I have a question regarding asserting ... here's some code: string GetAssertMessage() { ... prepare a message string and return it... } void SomeMethod() { ...
3
16708
by: Gunawan | last post by:
In vs 6 I can use debug.print as alternatif debugging value at runtime. Which function that I can use in C# 2005 Express for windows form apps? TIA, Gunawan
2
2731
by: Jeremy S. | last post by:
By default, Web.config has the following section: <compilation defaultLanguage="c#" debug="true" /> note that debug="true" There is a comment - also in the default Web.config - that states that making debug="false" will result in faster performance but a loss of
6
41949
by: Christian Blackburn | last post by:
Hi Gang, I'm wondering what the VB6 equivalent of Debug.Print is? Thanks in Advance, Christian Blackburn
7
1582
by: Tom | last post by:
How can I make code not execute for a debug build, but do execute for a production build? I have code which prompts for an account and password when the program starts up. It is a pain to have to answer that when I repeatly run the program during debugging, but it is desired by my client. Presently I just comment it out when I am debugging,...
0
875
by: zylkm | last post by:
Hi, when I compile a console project in Visual Studio 2005(C#) ,it's output is:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll...
3
2503
by: Martin Wiechert | last post by:
Hi list, I've created a fresh build of Python 2.4.3 using the following configuration $ ./configure --with-pydebug --prefix=/usr/local/debug --enable-shared --with-fpectl --with-signal-module in particular I used --with-pydebug. Now when I start the interpreter some dynamically loaded modules do not see
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.