@@ -1036,8 +1036,21 @@ internal static bool PyLong_Check(IntPtr ob)
1036
1036
[ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1037
1037
internal static extern IntPtr PyLong_FromLong( long value) ;
1038
1038
1039
- [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1040
- internal static extern IntPtr PyLong_FromUnsignedLong( uint value) ;
1039
+ [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl,
1040
+ EntryPoint = "PyLong_FromUnsignedLong") ]
1041
+ internal static extern IntPtr PyLong_FromUnsignedLong32( uint value) ;
1042
+
1043
+ [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl,
1044
+ EntryPoint = "PyLong_FromUnsignedLong") ]
1045
+ internal static extern IntPtr PyLong_FromUnsignedLong64( ulong value) ;
1046
+
1047
+ internal static IntPtr PyLong_FromUnsignedLong( object value)
1048
+ {
1049
+ if ( Is32Bit || IsWindows)
1050
+ return PyLong_FromUnsignedLong32( Convert. ToUInt32( value) ) ;
1051
+ else
1052
+ return PyLong_FromUnsignedLong64( Convert. ToUInt64( value) ) ;
1053
+ }
1041
1054
1042
1055
[ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1043
1056
internal static extern IntPtr PyLong_FromDouble( double value) ;
@@ -1054,8 +1067,21 @@ internal static bool PyLong_Check(IntPtr ob)
1054
1067
[ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1055
1068
internal static extern int PyLong_AsLong( IntPtr value) ;
1056
1069
1057
- [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1058
- internal static extern uint PyLong_AsUnsignedLong( IntPtr value) ;
1070
+ [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl,
1071
+ EntryPoint = "PyLong_AsUnsignedLong") ]
1072
+ internal static extern uint PyLong_AsUnsignedLong32( IntPtr value) ;
1073
+
1074
+ [ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl,
1075
+ EntryPoint = "PyLong_AsUnsignedLong") ]
1076
+ internal static extern ulong PyLong_AsUnsignedLong64( IntPtr value) ;
1077
+
1078
+ internal static object PyLong_AsUnsignedLong( IntPtr value)
1079
+ {
1080
+ if ( Is32Bit || IsWindows)
1081
+ return PyLong_AsUnsignedLong32( value) ;
1082
+ else
1083
+ return PyLong_AsUnsignedLong64( value) ;
1084
+ }
1059
1085
1060
1086
[ DllImport( _PythonDll, CallingConvention = CallingConvention. Cdecl) ]
1061
1087
internal static extern long PyLong_AsLongLong( IntPtr value) ;
0 commit comments