@@ -110,29 +110,31 @@ type
110110
111111 ppcuint8 = ^pcuint8;
112112
113- (* wchar_t is the "wide character" type of the C language.
114- * The size of this type is platform- and compiler-dependent.
115- *
116- * While FPC does have it's own "wide character" type, System.WideChar,
117- * that one is defined as always being 16-bits, so we can't re-use it here.
118- *
119- * When using FPC on Unices, the UnixType unit provides a wchar_t definition.
120- *
121- * On other systems/compiler combos, let's just go
122- * by what the CPP reference wiki claims, i.e:
123- * - wchar_t is 16-bits on Windows
124- * - wchar_t is 32-bits on Linux "and many other non-Windows systems"
125- *
126- * See: https://en.cppreference.com/w/cpp/language/types#Character_types
127- *)
128- { $IF DEFINED(FPC) AND DEFINED(UNIX)}
129- cwchar_t = UnixType.wchar_t;
130- { $ELSE}
131- { $IF DEFINED(WIN32) OR DEFINED(WIN64)}
132- cwchar_t = cuint16;
113+ { $IFDEF WANT_CWCHAR_T}
114+ (* wchar_t is the "wide character" type of the C language.
115+ * The size of this type is platform- and compiler-dependent.
116+ *
117+ * While FPC does have it's own "wide character" type, System.WideChar,
118+ * that one is defined as always being 16-bits, so we can't re-use it here.
119+ *
120+ * When using FPC on Unices, the UnixType unit provides a wchar_t definition.
121+ *
122+ * On other systems/compiler combos, let's just go
123+ * by what the CPP reference wiki claims, i.e:
124+ * - wchar_t is 16-bits on Windows
125+ * - wchar_t is 32-bits on Linux "and many other non-Windows systems"
126+ *
127+ * See: https://en.cppreference.com/w/cpp/language/types#Character_types
128+ *)
129+ { $IF DEFINED(FPC) AND DEFINED(UNIX)}
130+ cwchar_t = UnixType.wchar_t;
133131 { $ELSE}
134- cwchar_t = cuint32;
132+ { $IF DEFINED(WIN32) OR DEFINED(WIN64)}
133+ cwchar_t = cuint16;
134+ { $ELSE}
135+ cwchar_t = cuint32;
136+ { $ENDIF}
135137 { $ENDIF}
138+ { $EXTERNALSYM cwchar_t}
139+ pcwchar_t = ^cwchar_t;
136140 { $ENDIF}
137- { $EXTERNALSYM cwchar_t}
138- pcwchar_t = ^cwchar_t;
0 commit comments