Re: Weird error during programme startup



"Andrew Lowe" wrote:
I managed to draw the short straw at work and ended up doing the
twin conversion of ANSI to Unicode and VC++ 6 to VC++ 8. I've finally
gone right through the code and _T("...")'d everywhere, moved stuff into
string tables and so on. I've finally managed to get the whole app to
compile and link and run. Well sort of run. Before the splash screen
appears I get a "standard" error dialogue with the following:

------------------------

Microsoft Visual C++ Debug Library

Debug Assertion Failed
Program: My programme.exe
File: f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxwin1.inl
Line: 24

Blah
Blah

Abort Retry Ignore

------------------------

I managed to get to the call stack and eventually traced this down
to a problem in _initterm() which is in crt0dat.c - MS code that I have
NO IDEA as to what's going on in. As an aside, I've now rebuilt this app
in release mode and the problem no longer exists, but I still need it to
work in debug for obvious reasons. Does anyone have any idea as to what's
going wrong here. I've stepped through the innards of _initterm and it
appears to be doing a whole lot of initialisation - other than that, I'm
stuffed as to whether I can work out what's going on - and wrong.

If anyone has any thoughts on what's going wrong and causing this
dialogue to pop up, it would be greatly appreciated if they could share
the knowledge.


`_initterm' function calls constructors for all static objects in a module. I opened "afxwin1.inl" on my machine and it contains following ASSERT at line 24:

23 _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
24 { ASSERT(afxCurrentResourceHandle != NULL); <-- Assert!
25 return afxCurrentResourceHandle; }

Obviously, it won't assert in release builds. You said that you moved all strings to string tables. Can it be the case that some global object tries to access resources from its contructor before all necessary initializations are done?

Alex

.



Relevant Pages

  • How do you think in Delphi can be improve debug usability?
    ... like a string) is disable in watch, but i can in Inspect or Evaluate? ... However evaluate is so far from the real debug experience. ... But multi-dimesional array is hard to get, ...
    (borland.public.delphi.non-technical)
  • Re: Application Logging
    ... VB IDE or an addon for that Debug code stripping. ... Public Sub DebugLog(sModule As String, sProc As String, _ ... Private Sub Command1_Click ... Dim j As Long, s As String ...
    (comp.lang.basic.visual.misc)
  • Re: functions that take many arguments...... + extern - what about it?
    ... By making the functions as small and simple as possible, we make them much easier to debug and hence to maintain. ... int nx; ... we will have to rely on probabilistic testing + code coverage + endpoint style tests. ... So for instance if a function takes a string, it is a good test to pass it an empty string. ...
    (comp.lang.c)
  • Re: Debugging
    ... Make sure "Generate Debug ... The getter functon returns a CString from the registry and passes it to the ... program as an stl string ie ... string getstringconst { ...
    (microsoft.public.vc.mfc)
  • Re: eval to dict problems NEWB going crazy !
    ... Now, if the malicious user can only damage their own system, maybe you ... I would never use eval on any string I didn't write myself. ... def parse_tuple: ... assert s.startswith ...
    (comp.lang.python)

Quantcast