Is popen not supported by android NDK?
I read this page and wondering if this is true
The same is possible with POSIX popen() but it is not currently supported by bionic, so you can't use that in Android JNI. Instead you can probably use the system() and pipe the output to a file and then read that file afterwards. Looks like the Java approach will be cleaner if you will be doing the rendering in Java.
But I also read someone suggesting to use popen. I also tried it myself but sometime my app crashes and I dont know why.
Is popen safe to use in android ndk?
Indeed, popen() will not work on Android. As GLIBC description states, any UNIX operating system needs a C library to make all system calls. These include threading memory allocation, working with files, etc. Because Android is based on Linux, it needs such library implemented, but because it's a small mobile OS, Google decided to write a "lite version" of libc called bionic. This library does not include popen(), therefore you can't use it. There is a description of bionic library in the NDK documentation which lives inside your NDK directory (for some reason it's not online). Hope this helps.
ReplyDelete