What is int* and long* of objective-c equivalent in C#?

228 Views Asked by At

I am trying to port a library of native iOS in Xamarin iOS by creating the binding library. I followed this tutorial. But I am stuck at the point of building the solution.

I had replaced void* with IntPtr because objective-c equivalent of void* is IntPtr in C#.

Any help will be appreciated. Thanks in advance.

Edit:

int32_t* and int64_t* of objective-c in C# to be more precise.

1

There are 1 best solutions below

0
On

The answer depends on the purpose of the pointers: to pass variables to a method/function so the callee can alter the value; or for general pointer arithmetic.

In the first case if the use is to return multiple values from then an out parameter is required. If the use is more general and the parameter is used to read & write the passed variable then use a ref parameter.

In the second case you should first consider redesigning your algorithms not to use pointers, which is more in keeping with the C# model. If you really need to perform general pointer manipulation then you need to use unsafe code and then the exact same pointer types you require are available.