Skip to content

Add __android_log_is_loggable_len #6

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

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub type c_va_list = raw::c_void;
pub type c_int = raw::c_int;
#[allow(non_camel_case_types)]
pub type c_char = raw::c_char;
#[allow(non_camel_case_types)]
pub type c_size_t = raw::c_ulong;

// automatically generated by rust-bindgen
Copy link
Member

@MarijnS95 MarijnS95 Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the side (unrelated to this PR), this doesn't sound very up-to-date :). There's no script or documentation explaining how to run bindgen to regenerate/update this file, and it's probably been edited by hand many times.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit awkward to have bindgen for android NDK (requires andoid NDK, which you can't ask every dev to install :)), unless it's separate from cargo build. Yes, it was done by hand, at least partially. In my defense, I thought these kinds of system definitions should not change, otherwise they would break downstream massively.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's always the option to just run it once and check in the generated bindings - without modifying them by hand - that is exactly what I do for the ndk-sys crate 🙂

That way there is at least a reference describing how to exactly translate the bindings. Existing symbols shouldn't change - and I guess everyone hoped/expected the log API to stay very small - but adding new APIs becomes slightly more convenient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7 🎉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing with your knowledge :)


Expand Down Expand Up @@ -89,5 +91,10 @@ extern "C" {
tag: *const c_char,
default_prio: c_int)
-> c_int;
pub fn __android_log_is_loggable_len(prio: c_int,
tag: *const c_char,
size: c_size_t,
default_prio: c_int)
-> c_int;
pub fn __android_log_write_log_message(log_message: *mut __android_log_message);
}