If you run `printf("Event: %s Value: %s ", event, ...
# kotlin-native
j
If you run
printf("Event: %s Value: %s ", event, value);
in a cinterop *.def file it does not seem to be sent to the stream output, is there anyway to make it show up the same way as println(..) does from commonCode ?
s
What happens if you add a new line character to the string?
Copy code
printf("Event: %s Value: %s \n", event, value);
j
Same thing
The calling function that hold the printf looks like:
Copy code
void BroadcastEventToUser(const char* event, const char* value){
    printf("Event: %s Value: %s \n", event, value);
    if(bce){
        bce(event, value);
    }
}
but I can't spot any errors in the setup
And I do know the method is being called, because without the bce check it crashes
s
Please try to clean and rebuild the project.
j
Cleaned and rebuilt, still does not show up. I mean it does know about the printf-method since no crash, but its not sending it into the multiplatform android log stream, while using println(..) in commonCode does
s
Do I understand correctly that you use Kotlin/Native to compile your code to Android NDK?
AFAIK, standard C
printf
function is not supposed to produce output to Android log streams: https://stackoverflow.com/questions/10274920/how-to-get-printf-messages-written-in-ndk-application Can this be the cause of your issue?
j
yeah you are probably correct, but I figured since println worked even in the android ndk, printf should work too, but that is probably the issue. I moved the printf code back to commonCode instead and just println for now there
s
println
!=
printf
.
println
doesn’t use
printf
when compiling to Android NDK.
j
So basicly println wraps the __android_log_print call then
good to know
Thanks