SFML / SFML.Net

Official binding of SFML for .Net languages

Home Page:https://www.sfml-dev.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent Type Mapping Of Size_T Parameters

Rosst0pher opened this issue · comments

commented

PInvoke methods and callbacks with size_t parameters or returns is inconsistently typed across SFML.Net.

Majority use uint

  • sfVideoMode_getFullScreenModes
  • sfRenderTexture_drawPrimitives
  • sfRenderWindow_drawPrimitives
  • sfShader_setFloatUniformArray
  • sfShader_setVec2UniformArray
  • sfShader_setVec3UniformArray
  • sfShader_setVec4UniformArray
  • sfShader_setMat3UniformArray
  • sfShader_setMat4UniformArray
  • sfShape_create
  • sfText_findCharacterPos
  • sfVertexArray_getVertexCount
  • sfVertexArray_getVertex
  • sfVertexArray_resize
  • sfSoundRecorder_create
  • sfSoundRecorder_getAvailableDevices

A few others use ulong

  • sfFront_createFromMemory
  • sfImage_createFromMemory
  • sfTexture_createFromMemory
  • sfMusic_createFromMemory
  • sfSoundBuffer_createFromMemory

given that size_t size is platform dependent, I believe in C# you'd normally use IntPtr, UIntPtr or the newer nint or nuint types in place of size_t. I'm not sure in detail what the consequences are for the current mappings of size_t but I think this was worth raising going forward as .NET does have preferred types for platform dependent sized types.