[cfe-dev] [PATCH] Libc++ Windows fixes

Ruben Van Boxem vanboxem.ruben at gmail.com
Thu Jun 30 14:25:11 PDT 2011


2011/6/30 Howard Hinnant <hhinnant at apple.com>:
>
> On Jun 28, 2011, at 3:15 PM, Ruben Van Boxem wrote:
>
>> This is a larger patch with a bit more changes. I added a
>> win32/support.h/cpp to add any missing functionality. For now that's
>> only a simple enum and a simple vasprintf implementation.
>>
>> Note that to get as far as this, with the current _STD macro problem
>> (because it is used internally in the MS headers), you need to add a
>> temporary workaround #define in the problematic file. That does not
>> have to be committed!
>
> I'll just change _STD to _VSTD (versioned std).  Is _VSTD already taken on windows?

a "grep -r "_VSTD" ." in the MSVC 10 include directory, the mingw-w64
include directory, and the Windows SDK v7.1 include directory turned
up no results, so this should be fine.

>
>>
>> The cerrno macro's are from Boost, so "yes, they are correct", and
>> "no, there are no license restrictions whatsoever". The _strto*_l
>> functions are available on Windows msvcrt version 7. That's the
>> default somewhere Vista/7-ish, so those aren't available on XP. I
>> believe the Linux locale patch also takes into consideration providing
>> a Windows alternative with little or no modification.
>
> These constants appear to me to be public knowledge (i.e. no copyright issues).

Good to know. Although the bottom of the mingw-w64 header here
http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-headers/include/psdk_inc/_wsa_errnos.h?revision=3546&view=markup
seems to imply there are more sensible defines (without that many
magic numbers, mostly to WSAE* codes which ought to come from
<winsock2.h>). I cannot judge the difference though...

>
>>
>> I'm quite sure the win32/support.h/cpp isn't the nicest solution,
>> please do as you wish, there just needs to be a central place to add
>> missing fundamental functionality. Perhaps a larger splitting of OS
>> dependent functionality might be appropriate in the future.
>>
>> As of with this patch (which includes the _STD clash workaround, I am
>> now stranded at the catopen call in __locale, which as a little
>> googling shows is very non-Windows-ish, and perhaps needs a lot more
>> than just extra constants, #defines and #includes.
>>
>> I would be pleased if anyone would commit at least the part of it they like :)
>
> Let me commit the _STD -> _VSTD first, and then create a new patch using that.

Thanks! I'd like to do more, but I think I've reached my knowledge and
capability limits. Some Windows guru (or even better, a Windows C++
guru) will have to step up and implement more of libc++ to be usable.
Remember that the _strto*_l functions are very new, and most probably
don't work on XP, and may not work on Vista. I look to the Linux patch
on this and *hope* it is general/compatible enough to work without
much modification on Windows as well.

Ruben




More information about the cfe-dev mailing list