Skip to content

Commit 2ee0d33

Browse files
committed
Add the WANT_CWCHAR_T compile-type symbol
1 parent d68857c commit 2ee0d33

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

units/ctypes.inc

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

units/sdl2.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ interface
153153
{$ENDIF}
154154

155155

156+
{$DEFINE WANT_CWCHAR_T}
156157
{$I ctypes.inc} // C data types
157158

158159
{SDL2 version of the represented header file}

0 commit comments

Comments
 (0)