Help w/ app crashing in MFC shared dll but not w\ static MFC using VC6 
Author Message
 Help w/ app crashing in MFC shared dll but not w\ static MFC using VC6

Hello,
An application that I'm upgrading to VC6 from VC5 gets an illegal operation
on startup, even before I get to the apps InitInstance.  Oddly enough, it
seems to be ok if I Statically Link the MFC lib but not when MFC is a shared
dll.  (Not to mention that it worked fine in VC5.)

I've gotten as far as a breakpoint on the failure in the file
mfc\src\objcore.cpp:
if (!AfxIsValidAddress(pOb, sizeof(CObject)))  Where pOb seems to be
invalid, but I dont know what that address is.

I would appreciate any tips and tricks for dealing with this problem......

Also, my bag of tricks is limited when outside of my code.  I dont know
where to begin.   Sometimes when I run into problems like this,  where I am
not familiar with the design or code, I wish I had a way to quickly place
breakpoints after every opening brace for every module just to see what the
last function call was.

Is there a book I can buy that describes better ways to debug problems like:
    1. Cant trace into system dll while trying to step into mfc source on
your way to a gpf
    2. Jumps to assembly
    3. Assertions that put you into low level mfc code but you dont know how
you got there

Thanks in advance



Fri, 21 Sep 2001 03:00:00 GMT  
 Help w/ app crashing in MFC shared dll but not w\ static MFC using VC6
I apologize, my last post was incorrect.
The failure occurs on the mfc source line:
if (!AfxIsValidAddress(pOb, pOb->GetRuntimeClass()->m_nObjectSize, FALSE))

The GetRuntimeClass method fails.

Thanks in advance



Fri, 21 Sep 2001 03:00:00 GMT  
 Help w/ app crashing in MFC shared dll but not w\ static MFC using VC6

Quote:

>     1. Cant trace into system dll while trying to step into mfc source on
> your way to a gpf

That's a Win9x limitation. Only a kernel de{*filter*} can help you with that - or
using WinNT.

Quote:
>     2. Jumps to assembly

That means that no debugging information on no source is available. That is
normal for system DLLs (although you can get VC++ 6.0 to use the DLL
exports as symbols with tools->options->debug->Load COFF & Exports.
If this happens inside the MFCDLL then that means your debugging information
is out of date or you don't have the source installed.

Quote:
>     3. Assertions that put you into low level mfc code but you dont know how
> you got there

No generic answers to this one. You have to look at the individual assert and
hope that you can figure out what the problem is. Sometimes its easy, and
sometimes...

That said, make sure that you have recompiled everything in your project
for VC++ 6.0 and that you are using the VC++ 6.0 MFC42D.DLL. The
debug versions of these DLLs are fatally incompatible between VC++ 5.0
and 6.0 and can cause endless grief. This is crucial. Delete all .obj and .pch
and .lib files in your projects.

Good luck.

--
.Bruce Dawson, Cavedog Entertainment.
Makers of Total Annihilation - http://www.*-*-*.com/



Sat, 22 Sep 2001 03:00:00 GMT  
 Help w/ app crashing in MFC shared dll but not w\ static MFC using VC6

Quote:

>That said, make sure that you have recompiled everything in your project
>for VC++ 6.0 and that you are using the VC++ 6.0 MFC42D.DLL. The
>debug versions of these DLLs are fatally incompatible between VC++ 5.0
>and 6.0 and can cause endless grief. This is crucial. Delete all .obj and
.pch
>and .lib files in your projects.

>Good luck.

>--
>.Bruce Dawson, Cavedog Entertainment.
>Makers of Total Annihilation - http://www.cavedog.com

Thanks for the assist
Before I got your post I moved all the source from the dlls into the main
project and now it seems to work.  I am not sure if it was the dll and its
implementation or if there is still some wild pointer lurking in another
area in memory now.

I guess I was wondering if there was a way to check the address of that pOb
in the assertion up against some thing that might tell me what object of
mine it was referring to.

I will go back to the copy with dlls and verify your suggestions,
thanks again



Sun, 23 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help: Crash when loading MFC 4.2 dll's in VC6 app (Access violation)

2. Memory Allocation using MFC App and DLL with shared MFC library

3. DoModal() crash with MFC shared DLL vs static library

4. DoModal() crash. (MFC shared DLL vs static library)

5. How to convert use shared MFC DLL to use MFC in static lib

6. MFC Static Library, MFC Shared dll

7. Differences between using MFC as shared dll and as static library in building time

8. Unfixed: Apps linked with MFC DLL and using CHtmlView crash on close under WinXP

9. Unfixed: Apps linked with MFC DLL and using CHtmlView crash on close under WinXP

10. Loading a static-mfc-dll using ocx in a non-mfc application

11. Making MFC extension dll using static MFC library

12. Creating an MFC extention DLL which uses MFC from a static library

 

 
Powered by phpBB® Forum Software