Open markdryan opened 11 years ago
There is a basename function in libgen.h in the ndk.
If you want conditional compilation for Android, test for the ANDROID symbol, as in
#ifdef __ANDROID__
#include <libgen.h>
#endif
I've also seen BIONIC used, but ANDROID is what the NDK doc says to use.
About syslog. You can #include
#include <android/log.h>
#define TAG "DLeynaNative"
#define LOGD(format, ...) \
__android_log_print(ANDROID_LOG_DEBUG, TAG, format, ##__VA_ARGS__);
#define LOGI(format, ...) \
__android_log_print(ANDROID_LOG_INFO, TAG, format, ##__VA_ARGS__);
#define LOGW(format, ...) \
__android_log_print(ANDROID_LOG_WARN, TAG, format, ##__VA_ARGS__);
#define LOGE(format, ...) \
__android_log_print(ANDROID_LOG_ERROR, TAG, format, ##__VA_ARGS__);
Just add a new type in the logtype (0=syslog, 1=glib) Add 2 = android and just implement it in log.c Add this option to settings & configure.ac By default on adroid, configure.ac --log-type=2
On 20/09/2013 15:15, Tom Keel wrote:
About syslog. You can #include and compile calls to syslog(), but I don't think they do anything -- I don't think there's any syslog daemon. There's a logcat daemon. You have to use Android-specific stuff to send traces to it. I defined myself some convenience macros for doing it:
|#include <android/log.h>
define TAG "DLeynaNative"
define LOGD(format, ...) \
**android_log_print(ANDROID_LOG_DEBUG, TAG, format, ##__VA_ARGS**);
define LOGI(format, ...) \
**android_log_print(ANDROID_LOG_INFO, TAG, format, ##__VA_ARGS**);
define LOGW(format, ...) \
**android_log_print(ANDROID_LOG_WARN, TAG, format, ##__VA_ARGS**);
define LOGE(format, ...) \
**android_log_print(ANDROID_LOG_ERROR, TAG, format, ##__VA_ARGS**);
|
— Reply to this email directly or view it on GitHub https://github.com/01org/dleyna-collabora-android/issues/60#issuecomment-24809289.
Ludovic Ferrandis Open Source Technology Center Intel Corporation
Just add a new type in the logtype (0=syslog, 1=glib) Add 2 = android and just implement it in log.c Add this option to settings & configure.ac By default on adroid, configure.ac --log-type=2
Agree we should do this. This way you'd get all the dLeyna logs sent to the Android logging system. We need to wait till we have PDT approval though before adding any android specific patches to dLeyna.
Perhaps we could maintain some local patches in this repo for this time being.
To summarise.
The problem is that the basename function cannot be found. I'm suprised this doesn't crash. Perhaps dleyna_log_init is never called in android. Anyway, I realize this needs to be fixed in dLeyna-core but I'm not sure how? Does it even make sense to call syslog functions on Android? If not, perhaps we can just disable this code for Android.