Skip to content
Permalink
Browse files

Use `android-rs-injected-glue` on Android

  • Loading branch information
mmatyas committed Dec 9, 2016
1 parent c3c086e commit 868ca2a3b0ef6c59f9e81e099ec5519454cb35c9
Showing with 17 additions and 6 deletions.
  1. +7 −0 Cargo.lock
  2. +1 −0 ports/servo/Cargo.toml
  3. +9 −6 ports/servo/main.rs

Some generated files are not rendered by default. Learn more.

@@ -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);

0 comments on commit 868ca2a

Please sign in to comment.
You can’t perform that action at this time.