[Mono-list] Mono-list Digest, Vol 30, Issue 30

Alan McGovern alan.mcgovern at gmail.com
Mon Oct 29 12:07:29 EDT 2007


How about:

public bool Is64Bit
{
    get { return IntPtr.Size == 8; }
}

That code works as long as the assumption that you're not running a 32bit
version of mono in a 64bit os holds true, which i think can only happen
under win64.

Alan.

On 10/29/07, Adrien Dessemond <adrien.dessemond at softhome.net> wrote:
>
> On Mon, October 29, 2007 12:15 pm, Ashish Goyal wrote:
>
> Hi Ashish,
>
> > Hello, How can I find that The Mono I am running on the system is 32-bit
> > or
> > 64-bit?
>
> A much cleaner apporach may exist (class property/constant somewhere...)
> but using an unsafe block can do the trick :
>
> int psize;
> unsafe {
>   psize=sizeof(char *);
> }
>
> Of course when you compile such a code, /unsafe must be given to the C#
> compiler. Note that unlike in C, sizeof(char *) is translated in a MSIL
> instruction rather than an integer constant.
>
> Kind regards,
>
> Adrien
>
>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071029/0b55e743/attachment.html 


More information about the Mono-list mailing list