views:

42

answers:

1

My application compiles with VC6 sp6, uses DBGHelp.lib to get stack information. The code is simmilar in debug and release compilations. The problem is that when executing the debug version, DBGHelp.dll loads msvcrt.dll (the release version). msvcrtd.dll is already loaded by my debug link anyway. So I end up having both msvcrtd.dll and msvcrt.dll in the process in debug version. The dsp is set to load default libraries, and msvcrt(d).lib are not mentioned directly at all. If I take out the code that uses DBGHelp.dll and remove DBGHelp.lib from the dsp link list, msvcrt.dll is not loaded.

How do I fix this?

I need to have only msvcrtd.dll in my debug execution.

Is there a special version of DBGHelp.dll for debug (that would use msvcrtd.dll)?

A: 

What is the problem with having both MSVCRT.LIB and MSVCRTD.DLL loaded? This is only in your Debug build anyway, I would have thought, as you seem to note in the question.

I don't think you really want to start messing around with Debug OS DLLs - that's what DBGHELP.DLL is - this is no more desirable than having your app load up a Debug Kernel32.dll, for example.

Steve Townsend
Rational Purify (memory leak analyzer) gives me a warning about having both of them. I actually don't know what the implications are. You sure there's no problem in having them both?
itaj
@itaj - I'll have a dig around but I can't imagine why this is a problem so long as memory models are mot mixed. Does dbghelp.dll return you allocated memory? It not you should be OK. No issue with C+ classes since the DLL has C interface.
Steve Townsend
There's no mixed ownership with DBHelp (no mixed alloc/free), if that happened it would probabely immediatly crash the application. I don't currently have any problems, I just assumed that the release msvcrt was not supposed to be loaded in debug build.
itaj
@itaj - I would think you are OK then - this is a warning only, after all. What's the Purify warning code?
Steve Townsend
A peer got this purify warning and told me, I think I probabely jumped too soon to conclude that having both in the same process is a problem. Just need not to mix the models. The purify warning might be something more local to his module, maybe there is some mixing of models there that will have to be solved. But that would be a local fix NP.Thanks for the help.
itaj