|
| 1 | +use crate::ffi::{PyInterpreterState, PyObject}; |
| 2 | +use std::os::raw::{c_char, c_int, c_uchar}; |
| 3 | + |
| 4 | +// skipped PyInit__imp |
| 5 | + |
| 6 | +extern "C" { |
| 7 | + pub fn _PyImport_IsInitialized(state: *mut PyInterpreterState) -> c_int; |
| 8 | + // skipped _PyImport_GetModuleId |
| 9 | + #[cfg(Py_3_7)] |
| 10 | + pub fn _PyImport_SetModule(name: *mut PyObject, module: *mut PyObject) -> c_int; |
| 11 | + #[cfg(Py_3_7)] |
| 12 | + pub fn _PyImport_SetModuleString(name: *const c_char, module: *mut PyObject) -> c_int; |
| 13 | + pub fn _PyImport_AcquireLock(); |
| 14 | + pub fn _PyImport_ReleaseLock() -> c_int; |
| 15 | + #[cfg(not(Py_3_7))] |
| 16 | + pub fn _PyImport_FindBuiltin(name: *const c_char) -> *mut PyObject; |
| 17 | + #[cfg(all(Py_3_7, not(Py_3_9)))] |
| 18 | + pub fn _PyImport_FindBuiltin(name: *const c_char, modules: *mut PyObject) -> *mut PyObject; |
| 19 | + #[cfg(not(Py_3_10))] |
| 20 | + pub fn _PyImport_FindExtensionObject(a: *mut PyObject, b: *mut PyObject) -> *mut PyObject; |
| 21 | + #[cfg(not(Py_3_7))] |
| 22 | + pub fn _PyImport_FixupBuiltin(module: *mut PyObject, name: *const c_char) -> c_int; |
| 23 | + #[cfg(Py_3_7)] |
| 24 | + pub fn _PyImport_FixupBuiltin( |
| 25 | + module: *mut PyObject, |
| 26 | + name: *const c_char, |
| 27 | + modules: *mut PyObject, |
| 28 | + ) -> c_int; |
| 29 | + #[cfg(not(Py_3_7))] |
| 30 | + pub fn _PyImport_FixupExtensionObject( |
| 31 | + a: *mut PyObject, |
| 32 | + b: *mut PyObject, |
| 33 | + c: *mut PyObject, |
| 34 | + ) -> c_int; |
| 35 | + #[cfg(Py_3_7)] |
| 36 | + pub fn _PyImport_FixupExtensionObject( |
| 37 | + a: *mut PyObject, |
| 38 | + b: *mut PyObject, |
| 39 | + c: *mut PyObject, |
| 40 | + d: *mut PyObject, |
| 41 | + ) -> c_int; |
| 42 | +} |
| 43 | + |
| 44 | +#[repr(C)] |
| 45 | +#[derive(Copy, Clone)] |
| 46 | +pub struct _inittab { |
| 47 | + pub name: *const c_char, |
| 48 | + pub initfun: Option<unsafe extern "C" fn() -> *mut PyObject>, |
| 49 | +} |
| 50 | + |
| 51 | +#[cfg_attr(windows, link(name = "pythonXY"))] |
| 52 | +extern "C" { |
| 53 | + pub static mut PyImport_Inittab: *mut _inittab; |
| 54 | +} |
| 55 | + |
| 56 | +extern "C" { |
| 57 | + pub fn PyImport_ExtendInittab(newtab: *mut _inittab) -> c_int; |
| 58 | +} |
| 59 | + |
| 60 | +#[repr(C)] |
| 61 | +#[derive(Copy, Clone)] |
| 62 | +pub struct _frozen { |
| 63 | + name: *const c_char, |
| 64 | + code: *const c_uchar, |
| 65 | + size: c_int, |
| 66 | +} |
| 67 | + |
| 68 | +#[cfg_attr(windows, link(name = "pythonXY"))] |
| 69 | +extern "C" { |
| 70 | + pub static mut PyImport_FrozenModules: *const _frozen; |
| 71 | +} |
0 commit comments