[Apple GCC v4.2.1] Unfathomable problem with unicode and frameworks...
I'm experiencing a very strange problem... The following trivial test code works as it should if it is injected in a single **Cocoa** application, but when I use it in one of my **frameworks**, I get absolutely unexpected results...

    wchar_t Buf[2048];
    wcscpy(Buf, L"/zbxbxklbvasyfiogkhgfdbxbx/bxkfiorjhsdfohdf/xbxasdoipppwejngfd/gjfdhjgfdfdjkg.sdfsdsrtlrt.ljlg/fghlfg");
    int len1 = wcslen(L"/zbxbxklbvasyfiogkhgfdbxbx/bxkfiorjhsdfohdf/xbxasdoipppwejngfd/gjfdhjgfdfdjkg.sdfsdsrtlrt.ljlg/fghlfg");
    int len2 = wcslen(WBUF);

    char Buf2[2048];
    Buf2[0]=0;
    wcstombs(Buf2, Buf, 2048);

    // ??? Buf2 == ""
    // ??? len1 == len2 == 57, but should be 101

<BR>

How can this be, have I gone mad? Even if there was a memory corruption, it couldn't possibly corrupt all these values allocated on stack... Why won't even the **wcslen(L"MyWideString")** work? Changing test string changes its length, but it is always wrong, **wcstombs** returns -1...

**setlocale()** is not used anywhere, test string contains only **ASCII** characters, in order to ease porting I use the **-fshort-wchar** compiler option, but it works fine in case of a test Cocoa application...

Please help!

[Apple GCC v4.2.1] Unfathomable problem with unicode and frameworks...
===

I'm experiencing a very strange problem... The following trivial test code works as it should if it is injected in a single **Cocoa** application, but when I use it in one of my **frameworks**, I get absolutely unexpected results...

    wchar_t Buf[2048];
    wcscpy(Buf, L"/zbxbxklbvasyfiogkhgfdbxbx/bxkfiorjhsdfohdf/xbxasdoipppwejngfd/gjfdhjgfdfdjkg.sdfsdsrtlrt.ljlg/fghlfg");
    int len1 = wcslen(L"/zbxbxklbvasyfiogkhgfdbxbx/bxkfiorjhsdfohdf/xbxasdoipppwejngfd/gjfdhjgfdfdjkg.sdfsdsrtlrt.ljlg/fghlfg");
    int len2 = wcslen(WBUF);

    char Buf2[2048];
    Buf2[0]=0;
    wcstombs(Buf2, Buf, 2048);

    // ??? Buf2 == ""
    // ??? len1 == len2 == 57, but should be 101

<BR>

How can this be, have I gone mad? Even if there was a memory corruption, it couldn't possibly corrupt all these values allocated on stack... Why won't even the **wcslen(L"MyWideString")** work? Changing test string changes its length, but it is always wrong, **wcstombs** returns -1...

**setlocale()** is not used anywhere, test string contains only **ASCII** characters, in order to ease porting I use the **-fshort-wchar** compiler option, but it works fine in case of a test Cocoa application...

Please help!
