2010/1/10 Andrew Hutchinson <andrewhutchin...@cox.net>:
> I think  "rb" is nop. However, O_BINARY is less portable.
>
> There is another way. If  MinGW hosted build  is linked with binmode.o - the
> default for files become binary
> Some other methods are here:
>
> http://oldwiki.mingw.org/index.php/binary
>
>
>
>
> Rafael Espindola wrote:
>>>
>>> I hacked fopen/open calls in  lto.c and lto-elf.c to use O_BINARY and
>>> "rb"
>>> and compilation with -flto was then successful!
>>>
>>> I am not sure how this should be fixed properly.
>>>
>>
>> Using O_BINARY and "rb" should be a nop on unix, no? Is it wrong to
>> use them on any arch we care about?
>>
>>
>>>
>>> Andy
>>>
>>
>> Cheers,
>>
>


Well, on linux (libc) fopen/freopen/etc the "b" is an nop (but
handled). For O_BINARY the common approach here is to do the following
condifition before use:

#ifndef O_BINARY
#define O_BINARY 0
#endif

This is a pattern pretty often used. To rely here on binmode.o is a
way, too, but it is the most ugly one, too. It affects any file open,
which isn't necessarily wanted.

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Reply via email to