Add dladdr bindings

This commit is contained in:
Alex Crichton 2015-11-02 17:03:19 -08:00
parent 56f610495b
commit 88d23e7ef8
2 changed files with 10 additions and 0 deletions

View File

@ -117,6 +117,7 @@ fn main() {
// Just pass all these through, no need for a "struct" prefix
"FILE" |
"fd_set" |
"Dl_info" |
"DIR" => ty.to_string(),
// Fixup a few types on windows that don't actually exist.
@ -229,6 +230,7 @@ fn main() {
"gettimeofday" if linux || android || freebsd => true,
"dlerror" if android => true, // const-ness is added
"dladdr" if musl => true, // const-ness only added recently
_ => false,
}

View File

@ -76,6 +76,13 @@ s! {
#[cfg(not(target_os = "android"))]
pub ipv6mr_interface: ::c_uint,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
}
pub const WNOHANG: ::c_int = 1;
@ -432,6 +439,7 @@ extern {
pub fn dlsym(handle: *mut ::c_void,
symbol: *const ::c_char) -> *mut ::c_void;
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
}
// TODO: get rid of this #[cfg(not(...))]