If I have an ELF binary written in C and compiled using an Android NDK, is there an API for logging messages so that they show up in logcat?
Yes. This can be done by including
#include <android/log.h>
and calling
int __android_log_print(
int prio,
const char *tag,
const char *fmt,
...
);
You can even set the default tag via
void __android_log_set_default_tag(
const char *tag
);
This way, you can put NULL
as the tag in __android_log_print
.
You'll have to add -llog
to your linker flags.