I’m looking for a C# integral data type that can hold 32 bit signed values on 32-bit machines and 64-bit signed values on 64-bit machines.
The reason for this is a P/Invoke call to a C function that receives a ssize_t parameter.
I know I could work with preprocessor directives to “DllImport” this function in different ways for different machines (with ints for 32-bit machines and longs for 64-bit), but that would require me to build and ship for different targets, which is very undesirable.
Any other solutions to this problem are very welcome, of course 😀
You can use the IntPtr type: