Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Dec 14, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

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

  • Loading branch information
mmatyas committed Dec 9, 2016
commit 868ca2a3b0ef6c59f9e81e099ec5519454cb35c9

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);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.