crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.47k stars 1.62k forks source link

Inconsistency in the definition of ULONG_PTR for Windows 32-bit #15049

Closed yanecc closed 1 month ago

yanecc commented 1 month ago

Bug Report

I have noticed an inconsistency in the definition of ULONG_PTR between the C language and Crystal in 32-bit systems.

In a 32-bit system, ULONG_PTR is supposed to be defined as unsigned long (Uint32), same with UINT_PTR

#if defined(_WIN64)
 typedef unsigned __int64 ULONG_PTR;
#else
 typedef unsigned long ULONG_PTR;
#endif

while in Crystal, it's https://github.com/crystal-lang/crystal/blob/7aeba1e508dc44e4bcc1d0c4bf989b7321906f0d/src/lib_c/x86_64-windows-msvc/c/basetsd.cr#L7

oprypin commented 1 month ago

Hi. Your report makes sense, but Crystal never aimed or claimed to support 32-bit Windows systems, only 64-bit. Also apparently according to the news, Windows itself is about to drop support of 32-bit x86 systems in two days

straight-shoota commented 1 month ago

The referenced binding is for the x86_64-windows-msvc target, so explicitly for 64-bit systems. Bindings for 32-bit Windows would be in a folder like lib_c/i386-windows-msvc, if Crystal would ever get support for that.