Hi Y’all,

I'm currently investigating various libs-base test failures on Windows 11 MSVC 
and I’m stuck on one particular failure involving the archiving and unarchiving 
of primitives into a binary bundle (Tests/base/coding/basictypes.m).

Apple describes NSArchiver as “[..] a concrete subclass of NSCoder [and] 
provides a way to encode objects into an architecture-independent format that 
can be stored in a file”. That’s why the test has precomputed .type files (e.g. 
BOOL-1.type) to validate the output of the archiver.

This validation fails: On Windows 11 MSVC a bool is 4-bytes long, thus the 
generated .type file is BOOL-4.type and the unarchive routine fails:

Failed test:     (2022-06-17 06:35:35.907 +0000) basictypes.m:157 ... can 
unarchive BOOL from D:/a/libs-base/libs 
base/source/Tests/base/coding/BOOL-1.type


Now, there has been some issues related to the difference between BOOL, 
WinBOOL, and WINBOOL 
(https://github.com/gnustep/libs-base/pull/247#discussion_r835060626 
<https://github.com/gnustep/libs-base/pull/247#discussion_r835060626>).

Here the difference:
I can’t find the definition of WinBOOL anywhere in the Windows Kit header 
files, nor online.
WINBOOL seems to be implicitly defined by the compiler switch -Ze and 
explicitly defined 
<https://github.com/gnustep/libs-base/blob/a9d601746f6a841a8fcf50c807a0f03f1cfd6edd/Source/libgnustep-base-entry.m#L28>
 in GNUstep.
BOOL is defined as typedef int in Windows.h.

Maybe we can explicitly pack BOOL into one byte while archiving to maintain the 
architecture-independent format, or redefine BOOL in GNUstep to the correct 
size?

Best Regards

Hugo

Reply via email to