From 30097510a8e49e16b2e8d1f62fd90d4258711f15 Mon Sep 17 00:00:00 2001 From: andreww Date: Tue, 17 Apr 2012 09:36:22 +0100 Subject: [PATCH] Demonstrate C# platform option. Signed-off-by: Thomas Nagy --- demos/csharp/Dye.cs | 15 ++++++++++++++- demos/csharp/wscript | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/demos/csharp/Dye.cs b/demos/csharp/Dye.cs index 0ba12436..d19a722f 100644 --- a/demos/csharp/Dye.cs +++ b/demos/csharp/Dye.cs @@ -1,3 +1,5 @@ +using System; + public class Dye { private string msg = ""; @@ -5,7 +7,18 @@ public class Dye { msg = _msg; } + private static string PointerSizeDescription { + get { + if (IntPtr.Size==8) { + return "64-bit"; + } else if (IntPtr.Size==4) { + return "32-bit"; + } + return "Unknown"; + } + } + public void display() { - System.Console.WriteLine(msg); + System.Console.WriteLine("{0} ({1})", msg, PointerSizeDescription); } } diff --git a/demos/csharp/wscript b/demos/csharp/wscript index a638c9fb..0f59d567 100644 --- a/demos/csharp/wscript +++ b/demos/csharp/wscript @@ -31,6 +31,7 @@ def build(bld): bld(features='cs', source='My.cs Dye.cs', gen='my.dll', name='mylib', csdebug='full') bld(features='cs', source='Hi.cs', includes='.', gen='hi.exe', use='mylib', name='hi') + bld(features='cs', source='Hi.cs', includes='.', gen='hi-x86.exe', use='mylib', name='hi', platform='x86') if bld.env.HAS_GTKSHARP: bld(features='cs', source='Simple.cs', includes='.', gen='mono-hello.exe', csflags=['-pkg:gtk-sharp-2.0'])