[Mono-osx] Interop 32/64 bit check

Jonathan Pryor jonpryor at vt.edu
Tue Apr 1 02:27:51 UTC 2014


On Mar 31, 2014, at 6:13 PM, McKinnon Chris <crmckinnon at shaw.ca> wrote:
> I’m writing interop code for Core Foundation on Mac OS X.  I’m curious if anyone has suggestions on how to determine when you are running 32/64 bit in Mono.

You could check IntPtr.Size to see if you’re on a 32-bit (IntPtr.Size == 4) or 64-bit (IntPtr.Size == 8) platform.

Alternatively, you could use a type which already defined as 32-bits on 32-bit platforms and 64-bits on 64-bit platforms: System.intPtr.

(Yes, math would be awful and suck, but assignment & comparison will properly work. Arithmetic would need to go through `long` first.)

> I wanted to avoid IntPrs as the code would get messy quick.

Ah. Uh…

 - Jon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20140331/fe8dbb8f/attachment.html>


More information about the Mono-osx mailing list