openvr
openvr copied to clipboard
Make code NativeAOT compatible
I know that C# files are autogenerated, but in case somebody what to use it without waiting for change in code gen tooling. This PR has 3 changes, all of them trivially can be updated in the codegen:
-
Marshal.SizeOf(Type)
switched toMarshal.SizeOf<T>()
-
Marshal.PtrToStructure(IntPtr, Type)
toMarshal.PtrToStructure<T>(IntPtr)
-
Marshal.PtrToStructure<string>(IntPtr)
is gross error, and should be mapped toMarshal.PtrToStringAnsi(IntPtr)
This and #707 should make life of C# developer, amenable and close #638 and #472.
Marshal.PtrToStructure<T>(IntPtr)
can be replaced by *((T*)IntPtr)