Skip to content

Conversation

kant2002
Copy link

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 to Marshal.SizeOf<T>()
  • Marshal.PtrToStructure(IntPtr, Type) to Marshal.PtrToStructure<T>(IntPtr)
  • Marshal.PtrToStructure<string>(IntPtr) is gross error, and should be mapped to Marshal.PtrToStringAnsi(IntPtr)

This and #707 should make life of C# developer, amenable and close #638 and #472.

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 to `Marshal.SizeOf<T>()`
 - `Marshal.PtrToStructure(IntPtr, Type)` to `Marshal.PtrToStructure<T>(IntPtr)`
 - `Marshal.PtrToStructure<string>(IntPtr)` is gross error, and should be mapped to `Marshal.PtrToStringAnsi(IntPtr)`
@SupinePandora43
Copy link

Marshal.PtrToStructure<T>(IntPtr) can be replaced by *((T*)IntPtr)

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

Successfully merging this pull request may close these issues.

RenderModel_TextureMap_(packed_)t Incorrect data types in C#
2 participants