|
9 | 9 |
|
10 | 10 | //============================================================================
|
11 | 11 | // This file is a hand-maintained stub - it implements clr.dll, which can be
|
12 |
| -// loaded by a standard CPython interpreter as an extension module. When it |
13 |
| -// is loaded, it bootstraps the managed runtime integration layer and defers |
| 12 | +// loaded by a standard CPython interpreter (on Windows) as an extension module. |
| 13 | +// When it is loaded, it bootstraps the managed runtime integration layer and defers |
14 | 14 | // to it to do initialization and put the clr module into sys.modules, etc.
|
15 | 15 |
|
16 | 16 | // The "USE_PYTHON_RUNTIME_*" defines control what extra evidence is used
|
|
21 | 21 | #define USE_PYTHON_RUNTIME_VERSION
|
22 | 22 |
|
23 | 23 | // If defined, the "PythonRuntimePublicKeyTokenData" data array must be
|
24 |
| -// set to Python.Runtime's public key token. |
25 |
| -//#define USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN |
| 24 | +// set to Python.Runtime's public key token. (sn -T Python.Runtin.dll) |
| 25 | +#define USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN |
26 | 26 |
|
27 | 27 | // If DEBUG_PRINT is defined, a few System.Console.WriteLine calls are made
|
28 | 28 | // to indicate what's going on during the load...
|
|
35 | 35 | .ver 4:0:0:0
|
36 | 36 | }
|
37 | 37 |
|
| 38 | +.assembly extern mscorlib |
| 39 | +{ |
| 40 | + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) |
| 41 | + .ver 2:0:0:0 |
| 42 | +} |
| 43 | + |
38 | 44 | .assembly clr
|
39 | 45 | {
|
40 | 46 | .hash algorithm 0x00008004
|
41 |
| - .ver 2:4:2:7 |
| 47 | + .ver 4:0:0:1 |
42 | 48 | }
|
43 | 49 |
|
44 | 50 | .module clr.dll
|
45 | 51 | .imagebase 0x00400000
|
46 | 52 | .subsystem 0x00000003
|
47 | 53 | .file alignment 512
|
48 | 54 |
|
| 55 | +#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN |
| 56 | +.data PythonRuntimePublicKeyTokenData = bytearray (50 00 fe a6 cb a7 02 dd) |
| 57 | +//.data PythonRuntimePublicKeyTokenData = bytearray (64 e1 4e 84 5a bf 2e 60) |
| 58 | +#endif |
| 59 | + |
49 | 60 | // This includes the platform-specific IL. The include search path
|
50 | 61 | // is set depending on whether we're compiling 32 or 64 bit.
|
51 | 62 | // This MUST come before any other .data directives!
|
52 | 63 | // Why, oh why, can't ilasm support command line #defines? :(
|
53 |
| -#include "clrmodule-platform.il" |
| 64 | +// |
| 65 | + |
| 66 | +//#include "clrmodule-platform.il" |
| 67 | + |
| 68 | +// From the manifest as seen by ildasm |
| 69 | +//%windir%\Microsoft.NET\Framework\v4.0.30319\ilasm /dll /pe64 /x64 clrmodule.il |
| 70 | +//.corflags 0x00000000 |
| 71 | +// Image base: 0x01550000 |
| 72 | +// .vtfixup [1] int64 fromunmanaged at D_00004008 // 0000000006000002 |
| 73 | + |
| 74 | +//%windir%\Microsoft.NET\Framework\v4.0.30319\ilasm /dll clrmodule.il |
| 75 | +// .vtfixup [1] int32 fromunmanaged at D_00004008 // 06000002 |
| 76 | +//.corflags 0x00000002 // 32BITREQUIRED |
| 77 | +// Image base: 0x015A0000 |
| 78 | + |
| 79 | +// With or without /pe64 /x64 switches. |
| 80 | +//{ |
| 81 | +// .vtentry 1 : 1 |
| 82 | +// .export [1] as initclr |
| 83 | +// ... } |
54 | 84 |
|
55 |
| -#ifdef USE_PYTHON_RUNTIME_PUBLIC_KEY_TOKEN |
56 |
| -.data PythonRuntimePublicKeyTokenData = bytearray (64 e1 4e 84 5a bf 2e 60) |
57 |
| -#endif |
58 | 85 |
|
59 | 86 | .class public auto ansi beforefieldinit clrModule extends [mscorlib]System.Object
|
60 | 87 | {
|
|
74 | 101 | .method public hidebysig static void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
|
75 | 102 | initclr() cil managed
|
76 | 103 | {
|
77 |
| - .vtentry 1:1 |
| 104 | +// .vtentry 1:1 |
78 | 105 | .export [1] as initclr
|
79 | 106 |
|
80 | 107 | .maxstack 6
|
|
117 | 144 |
|
118 | 145 | #ifdef USE_PYTHON_RUNTIME_VERSION
|
119 | 146 | // pythonRuntimeVersionString = "...";
|
120 |
| - ldstr "2.0.0.2" |
| 147 | + ldstr "4.0.0.1" |
121 | 148 | stloc pythonRuntimeVersionString
|
122 | 149 |
|
123 | 150 | // pythonRuntimeName.Version = new Version(pythonRuntimeVersionString);
|
|
0 commit comments