Yet another debug-to-release issue

J

jlea

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.
 
R

Ramsey

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
 
J

jlea

I gave this some thought and will probably give this a shot in my next go at
it - Thanks for the reply.
 
J

jlea

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top