--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
I am also facing the same issue.Did this issue resolved.
Could you please let me know the solution.
below are my CFLAGS(my code uses STLPORT library hence these flags are
required)
LOCAL_CFLAGS += -I$(STLPORT_BASE)/stlport \
-D__NEW__ \
-D__SGI_STL_INTERNAL_PAIR_H \
-DANDROID \
-DOS_ANDROID \
-DANDROID_NDK \
-D_STLP_NO_EXCEPTIONS
I was succeeded in using the __android_log_print directly in my JNI
code.
But I am facing the problem when when i try to define as suggested in
this mail chain.
Please provide the suggestions to solve the issue.
You may need your macro to explicitly pass the non-variable format argument:
#define LOGV(F, ...) __android_log_print(ANDROID_LOG_VERBOSE, "libnav", F, ##
__VA_ARGS__)
I personally use the following with success. It also automatically logs the
function from which LOG() was called.
#define LOG(M, ...) _log(__func__, M, ## __VA_ARGS__)
void _log( const char *func, const char *message, ...) {
va_list arg;
va_start(arg, message);
char str[256];
vsnprintf(str, 256, message, arg);
__android_log_print(ANDROID_LOG_DEBUG, "SomeTag", "%s: %s", func, str);
va_end(arg);
}
Also, don't forget to link with liblog, eg:
LOCAL_LDLIBS := -llog
Hope that helps
--
Olivier
If you happen to use my LOG() macro and _log() function, then you should also
instruct gcc to check the format and variable arguments with:
void _log(const char *func, const char *message, ...)
__attribute__ ((format (printf, 2, 3)));
Olivier
> --
>
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.