https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108408
Corinna <vinschen at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vinschen at redhat dot com --- Comment #1 from Corinna <vinschen at redhat dot com> --- (In reply to nightstrike from comment #0) > I should clarify that I'm unfamiliar with D, so what I'm putting here Ditto, so I can only comment on the correctness of copying the datastructures into D-land... > [...] > + struct __locale_t { > + char[7][31 + 1] categories; // #define _LC_LAST 7, #define > ENCODING_LEN 31 > + extern (C) int function(_reent*, char*, wchar, _mbstate_t*) wctomb; > + extern (C) int function(_reent*, wchar*, const char*, size_t, > _mbstate_t*) mbtowc; > + int cjk_lang; > + char* ctype_ptr; > + lconv lconv_member; // name collision > + // #ifndef __HAVE_LOCALE_INFO__ // FIXME: Which path is enabled on > cygwin by default? Cygwin has __HAVE_LOCALE_INFO__, so the else branch is required/ > + char[2] mb_cur_max; > + char[31 + 1] ctype_codeset; // #define ENCODING_LEN 31 > + char[31 + 1] message_codeset; // #define ENCODING_LEN 31 > + // #else > + // struct __lc_cats lc_cat[7]; // #define _LC_LAST 7 > + // #endif > + } > + > + struct _Bigint { > + _Bigint* _next; > + int _k; > + int _maxwds; > + int _sign; > + int _wds; > + ulong[1] _x; > + } > + > + struct _reent { > + int _errno; > + > + __sFILE64* _stdin; > + __sFILE64* _stdout; > + __sFILE64* _stderr; > + > + int _inc; > + char[25] _emergency; // #define _REENT_EMERGENCY_SIZE 25 > + > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT int _reserved_1; _REENT_BACKWARD_BINARY_COMPAT is set on Cygwin because we must not change size and layout of this structure. Other targets don't support dynamic linking so they are interested in saving space more than sticking to binary compat. Does D fail to support a preprocessor and including header file? That would make this so much more reader-friendly... > + __locale_t* _locale; > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT int _reserved_0; > + > + extern (C) void function(_reent*) __cleanup; > + > + _Bigint* _p5s; > + int _result_k; > + _Bigint* _result; > + _Bigint** _freelist; > + > + int _cvtlen; > + char* _cvtbuf; > + > + union U { > + struct { > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT unsigned int > _reserved_2; > + char* _strtok_last; > + char[26] _asctime_buf; // #define _REENT_ASCTIME_SIZE 26 > + __tm _localtime_buf; > + int _gamma_signgam; > + ulong _rand_next; // __extension__ unsigned long long > + _rand48 _r48; > + _mbstate_t _mblen_state; > + _mbstate_t _mbtowc_state; > + _mbstate_t _wctomb_state; > + char[8] _l64a_buf; > + char[24] _signal_buf; // #define _REENT_SIGNAL_SIZE 24 > + int _getdate_err; > + _mbstate_t _mbrlen_state; > + _mbstate_t _mbrtowc_state; > + _mbstate_t _mbsrtowcs_state; > + _mbstate_t _wcrtomb_state; > + _mbstate_t _wcsrtombs_state; > + int _h_errno; > + } // _reent; > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT > + struct { > + char*[30] _reserved_3; // unsigned > + uint[30] _reserved_4; > + } // _reserved_5; > + // #endif > + } // _new; > + > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT struct _atexit *_reserved_6; > + // #ifdef _REENT_BACKWARD_BINARY_COMPAT struct _atexit _reserved_7; > + extern (C) void function(int)* _sig_func; > + } > + > + struct __sFILE64 { > + char* _p; // unsigned char > + int _r; > + int _w; > + short _flags; > + short _file; > + __sbuf _bf; > + int _lbfsize; > + // ifdef _REENT_SMALL _reent* _data; > + void* _cookie; > + extern (C) int function(_reent*, void*, char*, int) _read; > + extern (C) int function(_reent*, void*, const char*, int) _write; > + extern (C) _fpos_t function(_reent*, void*, _fpos_t, int) _seek; > + extern (C) int function(_reent*, void*) _close; > + > + __sbuf _ub; > + char* _up; // unsigned char > + int _ur; > + > + char[3] _ubuf; // unsigned char > + char[1] _nbuf; // unsigned char > + > + __sbuf _lb; > + > + int _blksize; > + int _flags2; > + > + _off64_t _offset; > + extern (C) _fpos64_t function(_reent*, void*, _fpos64_t, int) > _seek64; > + > + // #ifndef __SINGLE_THREAD__ _flock_t _lock; #if*n*def __SINGLE_THREAD__. Cygwin is very certainly not single threaded, so the definition of _lock is required. > + _mbstate_t _mbstate; > + } > + > + alias shared(__sFILE64) FILE; > +} > else version (CRuntime_Glibc) > { > import core.stdc.wchar_ : mbstate_t; HTH, Corinna