Index: src/runtime/pyansistring.cs
===================================================================
--- src/runtime/pyansistring.cs	(revision 126)
+++ src/runtime/pyansistring.cs	(working copy)
@@ -1,63 +1,82 @@
-public class PyAnsiString : PySequence {
-	/// <summary>
-	/// PyAnsiString Constructor
-	/// </summary>
-	///
-	/// <remarks>
-	/// Creates a new PyAnsiString from an existing object reference. Note
-	/// that the instance assumes ownership of the object reference.
-	/// The object reference is not checked for type-correctness.
-	/// </remarks>
-
-	public PyAnsiString(IntPtr ptr) : base(ptr) { }
-
-
-	/// <summary>
-	/// PyString Constructor
-	/// </summary>
-	///
-	/// <remarks>
-	/// Copy constructor - obtain a PyAnsiString from a generic PyObject.
-	/// An ArgumentException will be thrown if the given object is not
-	/// a Python string object.
-	/// </remarks>
-
-	public PyAnsiString(PyObject o)
-		: base() {
-		if (!IsStringType(o)) {
-			throw new ArgumentException("object is not a string");
-		}
-		Runtime.Incref(o.obj);
-		obj = o.obj;
-	}
-
-
-	/// <summary>
-	/// PyAnsiString Constructor
-	/// </summary>
-	///
-	/// <remarks>
-	/// Creates a Python string from a managed string.
-	/// </remarks>
-
-	public PyAnsiString(string s)
-		: base() {
-		obj = Runtime.PyString_FromStringAndSize(s, s.Length);
-		if (obj == IntPtr.Zero) {
-			throw new PythonException();
-		}
-	}
-
-
-	/// <summary>
-	/// IsStringType Method
-	/// </summary>
-	///
-	/// <remarks>
-	/// Returns true if the given object is a Python string.
-	/// </remarks>
-
-	public static bool IsStringType(PyObject value) {
-		return Runtime.PyString_Check(value.obj);
-	}
-}
\ No newline at end of file
+// ==========================================================================
+// This software is subject to the provisions of the Zope Public License,
+// Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+// FOR A PARTICULAR PURPOSE.
+// ==========================================================================
+
+using System;
+namespace Python.Runtime {
+
+    /// <summary>
+    /// Represents a standard Python list object. See the documentation at
+    /// http://www.python.org/doc/current/api/listObjects.html for details.
+    /// </summary>
+
+    public class PyAnsiString : PySequence {
+        /// <summary>
+        /// PyAnsiString Constructor
+        /// </summary>
+        ///
+        /// <remarks>
+        /// Creates a new PyAnsiString from an existing object reference. Note
+        /// that the instance assumes ownership of the object reference.
+        /// The object reference is not checked for type-correctness.
+        /// </remarks>
+
+        public PyAnsiString(IntPtr ptr) : base(ptr) { }
+
+
+        /// <summary>
+        /// PyString Constructor
+        /// </summary>
+        ///
+        /// <remarks>
+        /// Copy constructor - obtain a PyAnsiString from a generic PyObject.
+        /// An ArgumentException will be thrown if the given object is not
+        /// a Python string object.
+        /// </remarks>
+
+        public PyAnsiString(PyObject o)
+            : base() {
+            if (!IsStringType(o)) {
+                throw new ArgumentException("object is not a string");
+            }
+            Runtime.Incref(o.obj);
+            obj = o.obj;
+        }
+
+
+        /// <summary>
+        /// PyAnsiString Constructor
+        /// </summary>
+        ///
+        /// <remarks>
+        /// Creates a Python string from a managed string.
+        /// </remarks>
+
+        public PyAnsiString(string s)
+            : base() {
+            obj = Runtime.PyString_FromStringAndSize(s, s.Length);
+            if (obj == IntPtr.Zero) {
+                throw new PythonException();
+            }
+        }
+
+
+        /// <summary>
+        /// IsStringType Method
+        /// </summary>
+        ///
+        /// <remarks>
+        /// Returns true if the given object is a Python string.
+        /// </remarks>
+
+        public static bool IsStringType(PyObject value) {
+            return Runtime.PyString_Check(value.obj);
+        }
+    }
+}
+
Index: src/runtime/clrmodule.pp.il
===================================================================
--- src/runtime/clrmodule.pp.il	(revision 0)
+++ src/runtime/clrmodule.pp.il	(revision 0)
@@ -0,0 +1,274 @@
+// ==========================================================================
+// This software is subject to the provisions of the Zope Public License,
+// Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+// FOR A PARTICULAR PURPOSE.
+// ==========================================================================
+
+//============================================================================
+// This file is a hand-maintained stub - it implements clr.dll, which can be
+// loaded by a standard CPython interpreter as an extension module. When it
+// is loaded, it bootstraps the managed runtime integration layer and defers
+// to it to do initialization and put the clr module into sys.modules, etc.
+
+// The "USE_PYTHON_RUNTIME_*" defines control what extra evidence is used
+// to help the CLR find the appropriate Python.Runtime assembly.
+
+// If defined, the "pythonRuntimeVersionString" variable must be set to
+// Python.Runtime's current version.
+#define USE_PYTHON_RUNTIME_VERSION
+
+// If defined, the "PythonRuntimePublicKeyTokenData" data array must be
+// set to Python.Runtime's public key token.
+//#define USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
+
+// If DEBUG_PRINT is defined, a few System.Console.WriteLine calls are made
+// to indicate what's going on during the load...
+//#define DEBUG_PRINT
+//============================================================================
+
+.assembly extern mscorlib
+{
+	.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+	.ver 2:0:0:0
+}
+
+.assembly clr
+{
+	.hash algorithm 0x00008004
+	.ver 2:0:0:2
+}
+
+.module clr.dll
+.imagebase 0x00400000
+.subsystem 0x00000003
+.file alignment 512
+
+// This includes the platform-specific IL.  The include search path
+// is set depending on whether we're compiling 32 or 64 bit.
+// This MUST come before any other .data directives!
+// Why, oh why, can't ilasm support command line #defines? :(
+#include "clrmodule-platform.il"
+
+#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
+.data PythonRuntimePublicKeyTokenData = bytearray (64 e1 4e 84 5a bf 2e 60)
+#endif
+
+.class public auto ansi beforefieldinit clrModule extends [mscorlib]System.Object
+{
+#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
+	.field static assembly int64 PythonRuntimePublicKeyToken at PythonRuntimePublicKeyTokenData
+#endif
+
+	.method public hidebysig specialname rtspecialname instance void
+		.ctor() cil managed
+	{
+		.maxstack 1
+		ldarg.0
+		call		instance void [mscorlib]System.Object::.ctor()
+		ret
+	}
+
+	.method public hidebysig static void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
+		initclr() cil managed
+	{
+		.vtentry 1:1
+		.export [1] as initclr
+
+		.maxstack  6
+		.locals init (
+			class [mscorlib]System.Reflection.Assembly		pythonRuntime,
+			class [mscorlib]System.Reflection.Assembly		executingAssembly,
+			class [mscorlib]System.Reflection.AssemblyName	pythonRuntimeName,
+			class [mscorlib]System.Type						pythonEngineType,
+			int8[]											publicKeyToken,
+			string											assemblyDirectory,
+			string											pythonRuntimeVersionString,
+			string											pythonRuntimeDllPath)
+
+		// pythonRuntime = null;
+		ldnull
+		stloc		pythonRuntime
+
+		.try
+		{
+#ifdef DEBUG_PRINT
+			ldstr		"Attempting to load Python.Runtime using standard binding rules... "
+			call		void [mscorlib]System.Console::Write(string)
+#endif
+
+			// Attempt to find and load Python.Runtime using standard assembly binding rules.
+			// This roughly translates into looking in order:
+			// - GAC
+			// - ApplicationBase
+			// - A PrivateBinPath under ApplicationBase
+			// With an unsigned assembly, the GAC is skipped.
+
+			// System.Reflection.AssemblyName pythonRuntimeName = new System.Reflection.AssemblyName();
+			newobj		instance void [mscorlib]System.Reflection.AssemblyName::.ctor()
+			stloc		pythonRuntimeName
+
+			// pythonRuntimeName.Name = "Python.Runtime";
+			ldloc		pythonRuntimeName
+			ldstr		"Python.Runtime"
+			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_Name(string)
+
+#ifdef USE_PYTHON_RUNTIME_VERSION
+			// pythonRuntimeVersionString = "...";
+			ldstr		"2.0.0.2"
+			stloc		pythonRuntimeVersionString
+
+			// pythonRuntimeName.Version = new Version(pythonRuntimeVersionString);
+			ldloc		pythonRuntimeName
+			ldloc		pythonRuntimeVersionString
+			newobj		instance void [mscorlib]System.Version::.ctor(string)
+			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_Version(class [mscorlib]System.Version)
+#endif
+
+#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
+			// publicKeyToken = new byte[] { ... };
+			ldc.i4.8
+			newarr		[mscorlib]System.Byte
+			dup
+			ldtoken		field int64 clrModule::PythonRuntimePublicKeyToken
+			call		void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, valuetype [mscorlib]System.RuntimeFieldHandle)
+			stloc		publicKeyToken
+
+			// pythonRuntimeName.SetPublicKeyToken(publicKeyToken);
+			ldloc		pythonRuntimeName
+			ldloc		publicKeyToken
+			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::SetPublicKeyToken(uint8[])
+#endif
+
+			// pythonRuntimeName.CultureInfo = System.Globalization.CultureInfo.InvariantCulture;
+			ldloc		pythonRuntimeName
+			call		class [mscorlib]System.Globalization.CultureInfo [mscorlib]System.Globalization.CultureInfo::get_InvariantCulture()
+			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_CultureInfo(class [mscorlib]System.Globalization.CultureInfo)
+
+			// return System.Reflection.Assembly.Load(pythonRuntimeName);
+			ldloc		pythonRuntimeName
+			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::Load(class [mscorlib]System.Reflection.AssemblyName)
+			stloc		pythonRuntime
+
+#ifdef DEBUG_PRINT
+			ldstr		"Success!"
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			leave.s		LOADED_PYTHON_RUNTIME
+		}
+		catch [mscorlib]System.Object
+		{
+#ifdef DEBUG_PRINT
+			ldstr		"Failed."
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			leave.s		EXIT_CLR_LOAD
+		}
+		EXIT_CLR_LOAD: nop
+
+		.try
+		{
+			// If the above fails for any reason, we fallback to attempting to load "Python.Runtime.dll"
+			// from the directory this assembly is running in. "This assembly" is probably "clr.pyd",
+			// sitting somewhere in PYTHONPATH.  This is using Assembly.LoadFrom, and inherits all the
+			// caveats of that call.  See MSDN docs for details.
+			// Suzanne Cook's blog is also an excellent source of info on this:
+			// http://blogs.msdn.com/suzcook/
+			// http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx
+			// http://blogs.msdn.com/suzcook/archive/2003/06/13/57180.aspx
+			// executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
+			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::GetExecutingAssembly()
+			stloc		executingAssembly
+
+			// assemblyDirectory = System.IO.Path.GetDirectoryName(executingAssembly.Location);
+			ldloc		executingAssembly
+			callvirt	instance string [mscorlib]System.Reflection.Assembly::get_Location()
+			call		string [mscorlib]System.IO.Path::GetDirectoryName(string)
+			stloc		assemblyDirectory
+
+			// pythonRuntimeDllPath = System.IO.Path.Combine(assemblyDirectory, "Python.Runtime.dll");
+			ldloc		assemblyDirectory
+			ldstr		"Python.Runtime.dll"
+			call		string [mscorlib]System.IO.Path::Combine(string, string)
+			stloc		pythonRuntimeDllPath
+
+#ifdef DEBUG_PRINT
+			ldstr		"Attempting to load Python.Runtime from: '{0}'... "
+			ldloc		pythonRuntimeDllPath
+			call		void [mscorlib]System.Console::Write(string, object)
+#endif
+
+			// pythonRuntime = System.Reflection.Assembly.LoadFrom(pythonRuntimeDllPath);
+			ldloc		pythonRuntimeDllPath
+			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::LoadFrom(string)
+			stloc		pythonRuntime
+
+#ifdef DEBUG_PRINT
+			ldstr		"Success!"
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			leave.s		LOADED_PYTHON_RUNTIME
+		}
+		catch [mscorlib]System.Object
+		{
+#ifdef DEBUG_PRINT
+			ldstr		"Failed."
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			leave.s		EXIT_PYTHONPATH_LOAD
+		}
+		EXIT_PYTHONPATH_LOAD: nop
+
+		// If we get here, we haven't loaded Python.Runtime, so bail.
+#ifdef DEBUG_PRINT
+		ldstr		"Could not load Python.Runtime, so sad."
+		call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+		ret
+
+		// Once here, we've successfully loaded SOME version of Python.Runtime
+		// So now we get the PythonEngine and execute the InitExt method on it.
+		LOADED_PYTHON_RUNTIME: nop
+		.try
+		{
+#ifdef DEBUG_PRINT
+			ldstr		"Running Python.Runtime.PythonEngine.InitExt()"
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			// pythonEngineType = pythonRuntime.GetType("Python.Runtime.PythonEngine");
+			ldloc		pythonRuntime
+			ldstr		"Python.Runtime.PythonEngine"
+			callvirt	instance class [mscorlib]System.Type [mscorlib]System.Reflection.Assembly::GetType(string)
+			stloc		pythonEngineType
+
+			// pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null);
+			ldloc		pythonEngineType
+			ldstr		"InitExt"
+			ldc.i4		0x100
+			ldnull
+			ldnull
+			ldnull
+			callvirt	instance object [mscorlib]System.Type::InvokeMember(	string,
+																				valuetype [mscorlib]System.Reflection.BindingFlags,
+																				class [mscorlib]System.Reflection.Binder,
+																				object,
+																				object[])
+			pop
+			leave.s    EXIT_TRY_INVOKE
+		}
+		catch [mscorlib]System.Object
+		{
+#ifdef DEBUG_PRINT
+			ldstr		"Error calling Python.Runtime.PythonEngine.InitExt()."
+			call		void [mscorlib]System.Console::WriteLine(string)
+#endif
+			leave.s    EXIT_TRY_INVOKE
+		}
+		EXIT_TRY_INVOKE: nop
+
+		ret
+	}
+}
+

Property changes on: src/runtime/clrmodule.pp.il
___________________________________________________________________
Added: svn:executable
   + *

Index: src/runtime/clrmodule.il
===================================================================
--- src/runtime/clrmodule.il	(revision 126)
+++ src/runtime/clrmodule.il	(working copy)
@@ -1,274 +0,0 @@
-// ==========================================================================
-// This software is subject to the provisions of the Zope Public License,
-// Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
-// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-// WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-// FOR A PARTICULAR PURPOSE.
-// ==========================================================================
-
-//============================================================================
-// This file is a hand-maintained stub - it implements clr.dll, which can be
-// loaded by a standard CPython interpreter as an extension module. When it
-// is loaded, it bootstraps the managed runtime integration layer and defers
-// to it to do initialization and put the clr module into sys.modules, etc.
-
-// The "USE_PYTHON_RUNTIME_*" defines control what extra evidence is used
-// to help the CLR find the appropriate Python.Runtime assembly.
-
-// If defined, the "pythonRuntimeVersionString" variable must be set to
-// Python.Runtime's current version.
-#define USE_PYTHON_RUNTIME_VERSION
-
-// If defined, the "PythonRuntimePublicKeyTokenData" data array must be
-// set to Python.Runtime's public key token.
-//#define USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
-
-// If DEBUG_PRINT is defined, a few System.Console.WriteLine calls are made
-// to indicate what's going on during the load...
-//#define DEBUG_PRINT
-//============================================================================
-
-.assembly extern mscorlib
-{
-	.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
-	.ver 2:0:0:0
-}
-
-.assembly clr
-{
-	.hash algorithm 0x00008004
-	.ver 2:0:0:2
-}
-
-.module clr.dll
-.imagebase 0x00400000
-.subsystem 0x00000003
-.file alignment 512
-
-// This includes the platform-specific IL.  The include search path
-// is set depending on whether we're compiling 32 or 64 bit.
-// This MUST come before any other .data directives!
-// Why, oh why, can't ilasm support command line #defines? :(
-#include "clrmodule-platform.il"
-
-#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
-.data PythonRuntimePublicKeyTokenData = bytearray (64 e1 4e 84 5a bf 2e 60)
-#endif
-
-.class public auto ansi beforefieldinit clrModule extends [mscorlib]System.Object
-{
-#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
-	.field static assembly int64 PythonRuntimePublicKeyToken at PythonRuntimePublicKeyTokenData
-#endif
-
-	.method public hidebysig specialname rtspecialname instance void
-		.ctor() cil managed
-	{
-		.maxstack 1
-		ldarg.0
-		call		instance void [mscorlib]System.Object::.ctor()
-		ret
-	}
-
-	.method public hidebysig static void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
-		initclr() cil managed
-	{
-		.vtentry 1:1
-		.export [1] as initclr
-
-		.maxstack  6
-		.locals init (
-			class [mscorlib]System.Reflection.Assembly		pythonRuntime,
-			class [mscorlib]System.Reflection.Assembly		executingAssembly,
-			class [mscorlib]System.Reflection.AssemblyName	pythonRuntimeName,
-			class [mscorlib]System.Type						pythonEngineType,
-			int8[]											publicKeyToken,
-			string											assemblyDirectory,
-			string											pythonRuntimeVersionString,
-			string											pythonRuntimeDllPath)
-
-		// pythonRuntime = null;
-		ldnull
-		stloc		pythonRuntime
-
-		.try
-		{
-#ifdef DEBUG_PRINT
-			ldstr		"Attempting to load Python.Runtime using standard binding rules... "
-			call		void [mscorlib]System.Console::Write(string)
-#endif
-
-			// Attempt to find and load Python.Runtime using standard assembly binding rules.
-			// This roughly translates into looking in order:
-			// - GAC
-			// - ApplicationBase
-			// - A PrivateBinPath under ApplicationBase
-			// With an unsigned assembly, the GAC is skipped.
-
-			// System.Reflection.AssemblyName pythonRuntimeName = new System.Reflection.AssemblyName();
-			newobj		instance void [mscorlib]System.Reflection.AssemblyName::.ctor()
-			stloc		pythonRuntimeName
-
-			// pythonRuntimeName.Name = "Python.Runtime";
-			ldloc		pythonRuntimeName
-			ldstr		"Python.Runtime"
-			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_Name(string)
-
-#ifdef USE_PYTHON_RUNTIME_VERSION
-			// pythonRuntimeVersionString = "...";
-			ldstr		"2.0.0.2"
-			stloc		pythonRuntimeVersionString
-
-			// pythonRuntimeName.Version = new Version(pythonRuntimeVersionString);
-			ldloc		pythonRuntimeName
-			ldloc		pythonRuntimeVersionString
-			newobj		instance void [mscorlib]System.Version::.ctor(string)
-			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_Version(class [mscorlib]System.Version)
-#endif
-
-#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN
-			// publicKeyToken = new byte[] { ... };
-			ldc.i4.8
-			newarr		[mscorlib]System.Byte
-			dup
-			ldtoken		field int64 clrModule::PythonRuntimePublicKeyToken
-			call		void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, valuetype [mscorlib]System.RuntimeFieldHandle)
-			stloc		publicKeyToken
-
-			// pythonRuntimeName.SetPublicKeyToken(publicKeyToken);
-			ldloc		pythonRuntimeName
-			ldloc		publicKeyToken
-			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::SetPublicKeyToken(uint8[])
-#endif
-
-			// pythonRuntimeName.CultureInfo = System.Globalization.CultureInfo.InvariantCulture;
-			ldloc		pythonRuntimeName
-			call		class [mscorlib]System.Globalization.CultureInfo [mscorlib]System.Globalization.CultureInfo::get_InvariantCulture()
-			callvirt	instance void [mscorlib]System.Reflection.AssemblyName::set_CultureInfo(class [mscorlib]System.Globalization.CultureInfo)
-
-			// return System.Reflection.Assembly.Load(pythonRuntimeName);
-			ldloc		pythonRuntimeName
-			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::Load(class [mscorlib]System.Reflection.AssemblyName)
-			stloc		pythonRuntime
-
-#ifdef DEBUG_PRINT
-			ldstr		"Success!"
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			leave.s		LOADED_PYTHON_RUNTIME
-		}
-		catch [mscorlib]System.Object
-		{
-#ifdef DEBUG_PRINT
-			ldstr		"Failed."
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			leave.s		EXIT_CLR_LOAD
-		}
-		EXIT_CLR_LOAD: nop
-
-		.try
-		{
-			// If the above fails for any reason, we fallback to attempting to load "Python.Runtime.dll"
-			// from the directory this assembly is running in. "This assembly" is probably "clr.pyd",
-			// sitting somewhere in PYTHONPATH.  This is using Assembly.LoadFrom, and inherits all the
-			// caveats of that call.  See MSDN docs for details.
-			// Suzanne Cook's blog is also an excellent source of info on this:
-			// http://blogs.msdn.com/suzcook/
-			// http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx
-			// http://blogs.msdn.com/suzcook/archive/2003/06/13/57180.aspx
-			// executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
-			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::GetExecutingAssembly()
-			stloc		executingAssembly
-
-			// assemblyDirectory = System.IO.Path.GetDirectoryName(executingAssembly.Location);
-			ldloc		executingAssembly
-			callvirt	instance string [mscorlib]System.Reflection.Assembly::get_Location()
-			call		string [mscorlib]System.IO.Path::GetDirectoryName(string)
-			stloc		assemblyDirectory
-
-			// pythonRuntimeDllPath = System.IO.Path.Combine(assemblyDirectory, "Python.Runtime.dll");
-			ldloc		assemblyDirectory
-			ldstr		"Python.Runtime.dll"
-			call		string [mscorlib]System.IO.Path::Combine(string, string)
-			stloc		pythonRuntimeDllPath
-
-#ifdef DEBUG_PRINT
-			ldstr		"Attempting to load Python.Runtime from: '{0}'... "
-			ldloc		pythonRuntimeDllPath
-			call		void [mscorlib]System.Console::Write(string, object)
-#endif
-
-			// pythonRuntime = System.Reflection.Assembly.LoadFrom(pythonRuntimeDllPath);
-			ldloc		pythonRuntimeDllPath
-			call		class [mscorlib]System.Reflection.Assembly [mscorlib]System.Reflection.Assembly::LoadFrom(string)
-			stloc		pythonRuntime
-
-#ifdef DEBUG_PRINT
-			ldstr		"Success!"
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			leave.s		LOADED_PYTHON_RUNTIME
-		}
-		catch [mscorlib]System.Object
-		{
-#ifdef DEBUG_PRINT
-			ldstr		"Failed."
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			leave.s		EXIT_PYTHONPATH_LOAD
-		}
-		EXIT_PYTHONPATH_LOAD: nop
-
-		// If we get here, we haven't loaded Python.Runtime, so bail.
-#ifdef DEBUG_PRINT
-		ldstr		"Could not load Python.Runtime, so sad."
-		call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-		ret;
-
-		// Once here, we've successfully loaded SOME version of Python.Runtime
-		// So now we get the PythonEngine and execute the InitExt method on it.
-		LOADED_PYTHON_RUNTIME: nop
-		.try
-		{
-#ifdef DEBUG_PRINT
-			ldstr		"Running Python.Runtime.PythonEngine.InitExt()"
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			// pythonEngineType = pythonRuntime.GetType("Python.Runtime.PythonEngine");
-			ldloc		pythonRuntime
-			ldstr		"Python.Runtime.PythonEngine"
-			callvirt	instance class [mscorlib]System.Type [mscorlib]System.Reflection.Assembly::GetType(string)
-			stloc		pythonEngineType
-
-			// pythonEngineType.InvokeMember("InitExt", System.Reflection.BindingFlags.InvokeMethod, null, null, null);
-			ldloc		pythonEngineType
-			ldstr		"InitExt"
-			ldc.i4		0x100
-			ldnull
-			ldnull
-			ldnull
-			callvirt	instance object [mscorlib]System.Type::InvokeMember(	string,
-																				valuetype [mscorlib]System.Reflection.BindingFlags,
-																				class [mscorlib]System.Reflection.Binder,
-																				object,
-																				object[])
-			pop
-			leave.s    EXIT_TRY_INVOKE
-		}
-		catch [mscorlib]System.Object
-		{
-#ifdef DEBUG_PRINT
-			ldstr		"Error calling Python.Runtime.PythonEngine.InitExt()."
-			call		void [mscorlib]System.Console::WriteLine(string)
-#endif
-			leave.s    EXIT_TRY_INVOKE
-		}
-		EXIT_TRY_INVOKE: nop
-
-		ret
-	}
-}
-
Index: src/monoclr/Makefile
===================================================================
--- src/monoclr/Makefile	(revision 126)
+++ src/monoclr/Makefile	(working copy)
@@ -1,9 +1,13 @@
 # Author: Christian Heimes
 
-PYTHON = python2.5
+PYTHON = python
 BASENAME = $(shell $(PYTHON) -c "import sys; print 'python%i.%i' % sys.version_info[:2]")
 GCC = gcc
-
+ifeq ($(origin WINDIR), undefined)
+    DLL_OR_SO = "-shared"
+else
+    DLL_OR_SO = "-dynamiclib"
+endif 
 PY_LIBS = $(shell $(PYTHON) -c "from distutils.sysconfig import get_config_vars; \
     print get_config_vars('BLDLIBRARY')[0]") -lpython
 PY_CFLAGS = -I$(shell $(PYTHON) -c "from distutils.sysconfig import get_config_vars; \
@@ -30,7 +34,7 @@ $(BASENAME): python.c 
 	$(GCC) $(PY_CFLAGS) $(PY_LIBS) python.c -o $(BASENAME)
 
 clr.so: clrmod.o pynetinit.o
-	$(GCC) $(LIBS) -dynamiclib pynetinit.o clrmod.o -o clr.so
+	$(GCC) $(LIBS) $(DLL_OR_SO) pynetinit.o clrmod.o -o clr.so
 
 clr$(BASENAME): clrpython.o pynetinit.o
 	$(GCC) $(LIBS) clrpython.o pynetinit.o -o clr$(BASENAME) 
Index: Makefile
===================================================================
--- Makefile	(revision 126)
+++ Makefile	(working copy)
@@ -16,6 +16,12 @@ UCS ?= $(shell $(PYTHON) -c "import sys;
 SITEPACKAGES = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; \
     print get_python_lib(plat_specific=1, standard_lib=0)")
 INSTALL=/usr/bin/install -m644
+ARCH_FULL = $(shell uname -m)
+ifneq (, $(findstring 86, $(ARCH_FULL)))
+	ARCH = x86
+else
+	ARCH = x64
+endif 
 
 ifeq ($(origin WINDIR), undefined)
     RUNNER = mono
@@ -70,6 +76,14 @@ Python.Runtime.dll: $(RUNTIME_CS)
 	$(CSC) /unsafe /target:library \
 	    $(RUNTIME_REF) /out:../../Python.Runtime.dll /recurse:*.cs
 
+src/runtime/clrmodule.il: src/runtime/clrmodule.pp.il
+ifeq ($(origin WINDIR), undefined)
+	cd "$(BASEDIR)/src/runtime";\
+	$(CPP) -C -P -x c++ -I $(ARCH) clrmodule.pp.il -o clrmodule.il
+else
+	cd "$(BASEDIR)/src/runtime";\
+	cp clrmodule.pp.il clrmodule.il
+endif
 
 clr.pyd: Python.Runtime.dll src/runtime/clrmodule.il
 	$(ILASM) /nologo /dll /quiet /output=clr.pyd \
@@ -106,7 +120,7 @@ realclean: clean
 	rm -f Python*.il Python*.il2 Python*.res
 	rm -rf build/
 	cd src/console; rm -rf bin; rm -rf obj; cd ../..;
-	cd src/runtime; rm -rf bin; rm -rf obj; cd ../..;
+	cd src/runtime; rm -rf bin; rm -rf obj; rm clrmodule.il; cd ../..;
 	cd src/testing; rm -rf bin; rm -rf obj; cd ../..;
 	cd src/embed_tests; rm -rf bin; rm -rf obj; rm -f TestResult.xml; cd ../..;
 	cd src/monoclr; make clean; cd ../..
