This took really a long time to find, mainly because
it happens only when debugging is disabled, so no
debugger support. I experienced crashes of programs
compiled with BCC5.5 that are using wxLocale and
intl.cpp when compiled with FINAL=1 (both library and
program). It happened with both the internat sample
and my own program. The problem that I discovered in
intl.cpp was that a return value of a function
StringAtOfs() is directly used as a return value of
wxMsgCatalog::GetString(), without getting assigned to
a variable. BCC5.5 doesn't like this, the original
value (a pointer to a translated string) never reached
the caller wxLocale::GetString(). The pointers that
are eventually passed to wxGetTranslation() were
invalid, and thus the program crashed. Putting a
temporary variable into wxMsgCatalog::GetString()
solves the problem. There is another fix for a BCC
specific warning.
Issue migrated from trac ticket # 4935
component: wxMSW | priority: normal
2001-02-25 21:13:11: anonymous created the issue
This took really a long time to find, mainly because it happens only when debugging is disabled, so no debugger support. I experienced crashes of programs compiled with BCC5.5 that are using wxLocale and intl.cpp when compiled with FINAL=1 (both library and program). It happened with both the internat sample and my own program. The problem that I discovered in intl.cpp was that a return value of a function StringAtOfs() is directly used as a return value of wxMsgCatalog::GetString(), without getting assigned to a variable. BCC5.5 doesn't like this, the original value (a pointer to a translated string) never reached the caller wxLocale::GetString(). The pointers that are eventually passed to wxGetTranslation() were invalid, and thus the program crashed. Putting a temporary variable into wxMsgCatalog::GetString() solves the problem. There is another fix for a BCC specific warning.