Re: Basic Unicode app fails in ntdll!RtlpWaitForCriticalSectionduring startup


2005-06-23 04:02:53 AM
cppbuilder8
Exact same thing happens with wcout, which is not surprising because
it's crashing during startup before ever reaching my code.
Thomas Maeder [TeamB] wrote:
Quote
Dan Rosart < XXXX@XXXXX.COM >writes:


>#include <iostream>


Technically, you also have to #include <ostream>here. <iostream>
declares std::cout (and std::wcout), but not (or not necessarily) the
non-member operator<<()s.



>#include "tchar.h"
>
>int _tmain(int argc, _TCHAR* argv[])
>{
>for (int i=1; i<argc; ++i) {
>std::cout << argv[i] << _T(" Length: ") << _tcslen(argv[i])
><< std::endl;
>}
>return 0;
>}
>
>I add the -tWU flag to BCC32 and change c0x32.obj to c0x32w.obj in the
>linker line, and it compiles just fine, but when I run it, it fails
>during startup with an access violation in
>ntdll!RtlpWaitForCriticalSection at 7C918FEA. (ie. before ever
>reaching my code.) It works as you would expect if I compile and run
>it as a non-Unicode app. Is there something obvious that I'm doing
>wrong? There seems to be a dearth of documentation on this, and I'm
>sure those of you making real applications with this IDE must be able
>to get something like this working.


What do you get if you use std::wcout instead of std::cout?