Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with BOOL on Windows #307

Closed

Conversation

johnathan-becker
Copy link

BOOL on GNUstep platforms is defined as unsigned char except on vxworks. Having this _WIN32 flag means that GNUstep GUI gorm files will not work as they are expecting unsigned char for bool.

@hmelder
Copy link
Collaborator

hmelder commented Nov 12, 2024

This change seems to conflict with the definition in windef.h.

Clang MSVC

In file included from D:/a/libobjc2/libobjc2/eh_win32_msvc.cc:10:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um\windows.h:175:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared\windef.h:24:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared\minwindef.h:157:29: error: typedef redefinition with different types ('int' vs 'unsigned char')
  157 | typedef int                 BOOL;
      |                             ^
D:/a/libobjc2/libobjc2\objc/runtime.h:137:23: note: previous definition is here
  137 | typedef unsigned char BOOL;
      |                       ^

Clang MSYS2

D:/a/libobjc2/libobjc2/objc/runtime.h:137:23: error: typedef redefinition with different types ('unsigned char' vs 'int')

  137 | typedef unsigned char BOOL;

      |                       ^

D:/a/_temp/msys64/clang64/include/minwindef.h:131:15: note: previous definition is here

  131 |   typedef int BOOL;

      |               ^

1 error generated.

@qmfrederik
Copy link
Collaborator

@johnathan-becker You need to set define __OBJC_BOOL (or an equivalent) to avoid MSYS2 from defining BOOL which would have a conflicting type. Also could make this an opt-in behavior by promoting STRICT_APPLE_COMPATIBILITY to a CMake option. See #309

@johnathan-becker
Copy link
Author

@johnathan-becker You need to set define __OBJC_BOOL (or an equivalent) to avoid MSYS2 from defining BOOL which would have a conflicting type. Also could make this an opt-in behavior by promoting STRICT_APPLE_COMPATIBILITY to a CMake option. See #309

Yes i see that. I think we can just close this MR as unworkable. I will have to test rebuilding the libobjc2 library with STRICT_APPLE_COMPATIBILITY and see if that fixes the issue. It seems like this would still cause conflicts with native Windows libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants