mirror of
https://github.com/servo/servo.git
synced 2025-09-10 23:18:20 +01:00
Use android-rs-injected-glue
on Android
This commit is contained in:
parent
c3c086e521
commit
868ca2a3b0
3 changed files with 17 additions and 6 deletions
|
@ -54,3 +54,4 @@ sig = "0.1"
|
|||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
libc = "0.2"
|
||||
android_glue = "0.2"
|
||||
android_injected_glue = {git = "https://github.com/mmatyas/android-rs-injected-glue"}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#[cfg(target_os = "android")]
|
||||
#[macro_use]
|
||||
extern crate android_glue;
|
||||
#[cfg(target_os = "android")]
|
||||
extern crate android_injected_glue;
|
||||
extern crate backtrace;
|
||||
// The window backed by glutin
|
||||
extern crate glutin_app as app;
|
||||
|
@ -247,18 +249,19 @@ fn args() -> Vec<String> {
|
|||
}
|
||||
|
||||
|
||||
// This extern definition ensures that the linker will not discard
|
||||
// the static native lib bits, which are brought in from the NDK libraries
|
||||
// we link in from build.rs.
|
||||
#[cfg(target_os = "android")]
|
||||
extern {
|
||||
fn app_dummy() -> libc::c_void;
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
#[allow(non_snake_case)]
|
||||
pub extern "C" fn android_main(app: *mut ()) {
|
||||
android_injected_glue::android_main2(app as *mut _, move |_, _| { main() });
|
||||
}
|
||||
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod android {
|
||||
extern crate android_glue;
|
||||
extern crate android_injected_glue;
|
||||
extern crate libc;
|
||||
|
||||
use self::libc::c_int;
|
||||
|
@ -272,7 +275,7 @@ mod android {
|
|||
redirect_output(STDERR_FILENO);
|
||||
redirect_output(STDOUT_FILENO);
|
||||
|
||||
unsafe { super::app_dummy(); }
|
||||
unsafe { android_injected_glue::ffi::app_dummy() };
|
||||
}
|
||||
|
||||
struct FilePtr(*mut self::libc::FILE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue