Exclude symbols that don't work cross-platform

As seen when trying to build on Linux in #169.
Removes:
- Windows-specific begin/end thread symbols that don't do anything
- Things that statically depend on `size_t`
- 64-bit printf specifiers that depend on int64_t definition
  (long vs long long)
This commit is contained in:
Susko3 2024-10-24 00:48:29 +01:00
parent 904f50cb99
commit fa61d32dfc
4 changed files with 14 additions and 45 deletions

View File

@ -619,33 +619,6 @@ namespace SDL
[return: NativeTypeName("char *")]
public static extern byte* Unsafe_SDL_iconv_string([NativeTypeName("const char *")] byte* tocode, [NativeTypeName("const char *")] byte* fromcode, [NativeTypeName("const char *")] byte* inbuf, [NativeTypeName("size_t")] nuint inbytesleft);
[return: NativeTypeName("bool")]
public static SDLBool SDL_size_mul_check_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
{
if (a != 0 && b > 0xffffffffffffffffUL / a)
{
return false;
}
*ret = a * b;
return true;
}
[return: NativeTypeName("bool")]
public static SDLBool SDL_size_add_check_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
{
if (b > 0xffffffffffffffffUL - a)
{
return false;
}
*ret = a + b;
return true;
}
[NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")]
public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL;
[NativeTypeName("#define SDL_MAX_SINT8 ((Sint8)0x7F)")]
public const sbyte SDL_MAX_SINT8 = ((sbyte)(0x7F));
@ -703,18 +676,6 @@ namespace SDL
[NativeTypeName("#define SDL_FLT_EPSILON 1.1920928955078125e-07F")]
public const float SDL_FLT_EPSILON = 1.1920928955078125e-07F;
[NativeTypeName("#define SDL_PRIs64 \"lld\"")]
public static ReadOnlySpan<byte> SDL_PRIs64 => "lld"u8;
[NativeTypeName("#define SDL_PRIu64 \"llu\"")]
public static ReadOnlySpan<byte> SDL_PRIu64 => "llu"u8;
[NativeTypeName("#define SDL_PRIx64 \"llx\"")]
public static ReadOnlySpan<byte> SDL_PRIx64 => "llx"u8;
[NativeTypeName("#define SDL_PRIX64 \"llX\"")]
public static ReadOnlySpan<byte> SDL_PRIX64 => "llX"u8;
[NativeTypeName("#define SDL_PRIs32 \"d\"")]
public static ReadOnlySpan<byte> SDL_PRIs32 => "d"u8;

View File

@ -79,12 +79,6 @@ namespace SDL
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void SDL_CleanupTLS();
[NativeTypeName("#define SDL_BeginThreadFunction NULL")]
public const int SDL_BeginThreadFunction = 0;
[NativeTypeName("#define SDL_EndThreadFunction NULL")]
public const int SDL_EndThreadFunction = 0;
[NativeTypeName("#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER \"SDL.thread.create.entry_function\"")]
public static ReadOnlySpan<byte> SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER => "SDL.thread.create.entry_function"u8;

View File

@ -10,3 +10,13 @@ SDL_SLOW_MEMSET
# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow.
--additional
--undefine-macro=__has_builtin
# Exclude symbols that differ on Windows and Unix
--exclude
SDL_size_mul_check_overflow
SDL_size_add_check_overflow
SDL_SIZE_MAX
SDL_PRIs64
SDL_PRIu64
SDL_PRIx64
SDL_PRIX64

View File

@ -8,3 +8,7 @@ SDL_CreateThread=System.Runtime.Versioning
--with-attribute
SDL_CreateThread=UnsupportedOSPlatform("windows")
SDL_CreateThreadWithStackSize=UnsupportedOSPlatform("windows")
--exclude
SDL_BeginThreadFunction
SDL_EndThreadFunction