use core::ffi::c_int;
pub const RTLD_LAZY: c_int = posix::RTLD_LAZY;
pub const RTLD_NOW: c_int = posix::RTLD_NOW;
pub const RTLD_GLOBAL: c_int = posix::RTLD_GLOBAL;
pub const RTLD_LOCAL: c_int = posix::RTLD_LOCAL;
#[cfg(all(libloading_docs, not(unix)))]
mod posix {
use super::c_int;
pub(super) const RTLD_LAZY: c_int = !0;
pub(super) const RTLD_NOW: c_int = !0;
pub(super) const RTLD_GLOBAL: c_int = !0;
pub(super) const RTLD_LOCAL: c_int = !0;
}
#[cfg(any(not(libloading_docs), unix))]
mod posix {
use cfg_if::cfg_if;
use super::c_int;
cfg_if! {
if #[cfg(target_os = "haiku")] {
pub(super) const RTLD_LAZY: c_int = 0;
} else if #[cfg(target_os = "aix")] {
pub(super) const RTLD_LAZY: c_int = 4;
} else if #[cfg(any(
target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "solaris",
target_os = "illumos",
target_env = "uclibc",
target_env = "newlib",
target_os = "fuchsia",
target_os = "redox",
target_os = "nto",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_LAZY: c_int = 1;
} else {
compile_error!(
"Target has no known `RTLD_LAZY` value. Please submit an issue or PR adding it."
);
}
}
cfg_if! {
if #[cfg(target_os = "haiku")] {
pub(super) const RTLD_NOW: c_int = 1;
} else if #[cfg(any(
target_os = "linux",
all(target_os = "android", target_pointer_width = "64"),
target_os = "emscripten",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "aix",
target_os = "solaris",
target_os = "illumos",
target_env = "uclibc",
target_env = "newlib",
target_os = "fuchsia",
target_os = "redox",
target_os = "nto",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_NOW: c_int = 2;
} else if #[cfg(all(target_os = "android",target_pointer_width = "32"))] {
pub(super) const RTLD_NOW: c_int = 0;
} else {
compile_error!(
"Target has no known `RTLD_NOW` value. Please submit an issue or PR adding it."
);
}
}
cfg_if! {
if #[cfg(any(
target_os = "haiku",
all(target_os = "android",target_pointer_width = "32"),
))] {
pub(super) const RTLD_GLOBAL: c_int = 2;
} else if #[cfg(target_os = "aix")] {
pub(super) const RTLD_GLOBAL: c_int = 0x10000;
} else if #[cfg(any(
target_env = "uclibc",
all(target_os = "linux", target_arch = "mips"),
all(target_os = "linux", target_arch = "mips64"),
target_os = "cygwin",
))] {
pub(super) const RTLD_GLOBAL: c_int = 4;
} else if #[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
))] {
pub(super) const RTLD_GLOBAL: c_int = 8;
} else if #[cfg(any(
target_os = "linux",
all(target_os = "android", target_pointer_width = "64"),
target_os = "emscripten",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "solaris",
target_os = "illumos",
target_env = "newlib",
target_os = "fuchsia",
target_os = "redox",
target_os = "nto",
target_os = "hurd",
))] {
pub(super) const RTLD_GLOBAL: c_int = 0x100;
} else {
compile_error!(
"Target has no known `RTLD_GLOBAL` value. Please submit an issue or PR adding it."
);
}
}
cfg_if! {
if #[cfg(any(
target_os = "netbsd",
target_os = "nto",
))] {
pub(super) const RTLD_LOCAL: c_int = 0x200;
} else if #[cfg(target_os = "aix")] {
pub(super) const RTLD_LOCAL: c_int = 0x80000;
} else if #[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "visionos",
target_os = "watchos",
))] {
pub(super) const RTLD_LOCAL: c_int = 4;
} else if #[cfg(any(
target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "haiku",
target_os = "solaris",
target_os = "illumos",
target_env = "uclibc",
target_env = "newlib",
target_os = "fuchsia",
target_os = "redox",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_LOCAL: c_int = 0;
} else {
compile_error!(
"Target has no known `RTLD_LOCAL` value. Please submit an issue or PR adding it."
);
}
}
}