This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: libiconv for windres
On Fri, Jun 01, 2007 at 11:51:32AM +0200, Kai Tietz wrote:
>Hi Danny,
>
>> Why is this table necessary on windows?
>> +/* Languages supported. */
>> +static const wind_language_t languages[] =
>> +{
>> ....
>> We can fetch the codepage from the language id by
>> using the windows API in winnt.h
>> and avoid having to resync when supported LANG,SUBLANG pairs change
>>
>>
>> static unsigned int
>> codepage_from_langid (unsigned short langid)
>> {
>> #define max_cp_string_len 6
>> char cp_string [max_cp_string_len];
>> int c;
>> memset (cp_string, 0, max_cp_string_len);
>> /* LOCALE_RETURN_NUMBER flag would avoid strtoul conversion,
>> but is unavailable on Win95. */
>> c = GetLocaleInfoA (MAKELCID (langid, SORT_DEFAULT),
>> LOCALE_IDEFAULTANSICODEPAGE,
>> cp_string, max_cp_string_len);
>> /* If codepage data for an LCID is not installed on users's system,
>> GetLocaleInfo returns an empty string. Fall back to system ANSI
>> default. */
>> if ( c == 0 )
>> return CP_ACP;
>> return strtoul (cp_string, 0, 10);
>> }
>
>Ok, I will use your method for _WIN32. An other question is, should we use
>iconv even on cygwin, or should we use on cygwin also the windows API ?
I think that, for windres, cygwin should use the Windows API. That means that
you can't just use _WIN32 but need to use __CYGWIN__ too.
cgf