-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Inconsistent Type Mapping Of Size_T Parameters #212
Comments
DemoXinMC
added a commit
to DemoXinMC/SFML.Net
that referenced
this issue
Jan 3, 2024
Somewhat addresses SFML#212 * Updated to use uint consistently where CSFML is expecting size_t * UIntPtr is the most correct type for size_t, but switching to it would result in breaking changes for end users * uint should be replaced with nuint when moving to .NET 5+
DemoXinMC
added a commit
to DemoXinMC/SFML.Net
that referenced
this issue
Jan 3, 2024
Somewhat addresses SFML#212 * Updated to use UIntPtr where CSFML is expecting size_t * Since all changes are within protected code, should not represent a breaking change for end-users * UIntPtr should be replaced with nuint when moving to .NET 5+ * Implemented Font(byte[]) properly using sfFont_createFromMemory() instead of creating a new MemoryStream
DemoXinMC
added a commit
to DemoXinMC/SFML.Net
that referenced
this issue
Jan 3, 2024
Addresses SFML#212 * Updated to use a SIZE_T "macro" where CSFML is expecting `size_t` * `using SIZE_T = UIntPtr;` is at the beginning of each file that will P/Invoke functions with `size_t` signatures * SIZE_T is currently typedef'd to `UIntPtr` but this can be changed when `nuint` becomes available to SFML.NET (.NET 5+) * Since all changes are within protected/private code, this should not represent a breaking change for end-users * Implemented Font(byte[]) properly using sfFont_createFromMemory() instead of creating a new MemoryStream
Fixed by #253 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PInvoke methods and callbacks with
size_t
parameters or returns is inconsistently typed across SFML.Net.Majority use
uint
A few others use
ulong
given that
size_t
size is platform dependent, I believe in C# you'd normally useIntPtr
,UIntPtr
or the newernint
ornuint
types in place ofsize_t
. I'm not sure in detail what the consequences are for the current mappings ofsize_t
but I think this was worth raising going forward as .NET does have preferred types for platform dependent sized types.The text was updated successfully, but these errors were encountered: