|
7 | 7 | using System.Reflection;
|
8 | 8 | using System.Runtime.InteropServices;
|
9 | 9 | using Python.Runtime.Native;
|
| 10 | +using Python.Runtime.Interfaces; |
10 | 11 |
|
11 | 12 | namespace Python.Runtime
|
12 | 13 | {
|
@@ -118,11 +119,6 @@ public static string BuildInfo
|
118 | 119 | get { return Marshal.PtrToStringAnsi(Runtime.Py_GetBuildInfo()); }
|
119 | 120 | }
|
120 | 121 |
|
121 |
| - public static string Platform |
122 |
| - { |
123 |
| - get { return Marshal.PtrToStringAnsi(Runtime.Py_GetPlatform()); } |
124 |
| - } |
125 |
| - |
126 | 122 | public static string Copyright
|
127 | 123 | {
|
128 | 124 | get { return Marshal.PtrToStringAnsi(Runtime.Py_GetCopyright()); }
|
@@ -263,10 +259,12 @@ public static int InternalInitialize(IntPtr data, int size)
|
263 | 259 |
|
264 | 260 | try
|
265 | 261 | {
|
266 |
| - // Console.WriteLine("Before Initialize"); |
267 |
| - // Console.Out.Flush(); |
| 262 | + Console.WriteLine("Running on {0}", RuntimeInformation.FrameworkDescription); |
| 263 | + |
| 264 | + var ass = Platform.InternalLoadContext.Instance.LoadFromAssemblyName(new AssemblyName("Python.Runtime.Native")); |
268 | 265 |
|
269 |
| - // Python.Runtime.Platform.InternalLoadContext.Instance.EnterContextualReflection(); |
| 266 | + var typ = ass.GetType("Python.Runtime.Native.LibPythonPInvoke"); |
| 267 | + Runtime.LibPython = (ILibPython)Activator.CreateInstance(typ); |
270 | 268 |
|
271 | 269 | Initialize(setSysArgv: false);
|
272 | 270 |
|
@@ -316,8 +314,8 @@ public static int InternalInitialize(IntPtr data, int size)
|
316 | 314 | }
|
317 | 315 | catch (Exception e)
|
318 | 316 | {
|
319 |
| - // Console.Error.WriteLine(e.ToString()); |
320 |
| - // Console.Error.Write(e.StackTrace); |
| 317 | + Console.Error.WriteLine(e.ToString()); |
| 318 | + Console.Error.Write(e.StackTrace); |
321 | 319 | return -2;
|
322 | 320 | }
|
323 | 321 | }
|
|
0 commit comments