Open amerkoleci opened 3 years ago
Having PointerSize
might theoretically enable us to provide APIs not available on pre-.NET5 runtimes (like IComparable
). But yeah, using these is simpler.
Not sure what you mean, nuint maps to UIntPtr and nint maps to IntrPtr, so there is no special magin under the hood.
If you plan to keep PointerSize then we need UPointerSize with ulong and map SIZE_T to that instance. Otherwise we'll end in marshalling issues (https://github.com/amerkoleci/Vortice.Windows/issues/185)
Yeah, I know that nint
is a syntax sugar for System.IntPtr
and native int
. But until .NET 5 (dotnet/runtime#307) IntPtr had a much more narrow API surface, and so does the nint
on these older runtimes.
Hi @andrew-boyarshin , Recent .NET language added nint and nuint support, I would suggest to remove PointerSize and map to those directly, same applies to SharpGen.Runtime.COM.
It is supported in ClangSharp as well: intptr_t -> nint ptrdiff_t -> nint size_t -> nuint uintptr_t -> nuint SIZE_T -> nuint SSIZE_T -> nint