| Crates.io | android_xdl |
| lib.rs | android_xdl |
| version | 0.0.3 |
| created_at | 2025-12-13 15:53:45.001471+00 |
| updated_at | 2025-12-21 08:39:25.689972+00 |
| description | xDL is an enhanced implementation of the Android DL series functions. |
| homepage | |
| repository | https://github.com/suqiernb/android-xdl-rs |
| max_upload_size | |
| id | 1983097 |
| size | 332,515 |
xDL is an enhanced implementation of the Android DL series functions.
[!WARNING] Currently in a preliminary state of availability, the api may be unstable.
Enhanced dlopen() + dlsym() + dladdr().
.dynsym..symtab and ".symtab in .gnu_debugdata".Enhanced dl_iterate_phdr().
Support Android 4.1 - 16 (API level 16 - 36).
Support armeabi-v7a, arm64-v8a, x86 and x86_64.
this library is xDL rust binding, provides a safe and easy to use API, dynamic link library for the Android platform on the loading and symbol lookup.
[dependencies]
android_xdl = { version = "0.0.2", features = ["derive"] }
use std::os::raw::*;
use android_xdl::{Library, Error};
#[allow(non_camel_case_types)]
type fn_puts_t = unsafe extern "C" fn(*const c_char) -> c_int;
fn main() -> Result<(), Error> {
let library = Library::open(c"libc.so")?;
let symbol = library.symbol::<fn_puts_t>(c"puts")?;
let string = c">> Hello World !\n>> 中文字符测试\n>> 表情符号测试😎";
unsafe { symbol(string.as_ptr()) };
Ok(())
}
use std::os::raw::*;
use android_xdl::wrapper::Container;
use android_xdl::{Error, Library};
use android_xdl::derive::NativeBridge;
#[derive(NativeBridge)]
struct LibcApi {
puts: unsafe extern "C" fn(*const c_char) -> c_int,
getpid: unsafe extern "C" fn() -> c_int,
getuid: unsafe extern "C" fn() -> c_uint,
}
fn main() -> Result<(), Error> {
let api = Container::<LibcApi>::from(Library::open(c"libc.so")?)?;
unsafe {
let pid = api.getpid();
let uid = api.getuid();
log::debug!("PID: {}, UID: {}", pid, uid);
api.puts(c"puts: \tHello World\n\t中文字符测试\n\t表情符号测试😎".as_ptr());
}
Ok(())
}
MIT licensed, as found in the LICENSE file.