Is busybox available in shared library form? I would like to use individual apps programmatically instead of using system()
. I've heard about libbusybox and libbb but could not find any documentation.
views:
56answers:
2
+1
A:
If such a library existed for busybox, it would probably call fork
or system
anyway, so there is no real difference.
Delan Azabani
2010-08-21 01:12:03
Of course it wouldn't need to call `fork`. Want a list of files that would usually been obtained by calling `grep`? Call the function that implements `grep` functionality in BusyBox. No fork.
Pascal Cuoq
2010-08-21 09:49:12
Yes... but... that would only work if the program you are trying to use has dev headers so that you can call its internal functions. Otherwise, for binary-only applications, you're stuck with calling them externally.
Delan Azabani
2010-08-21 09:52:29
The problem is that it would probably call `exit(x)` without returning to the psudo_main function, and then your probram would be dead.
nategoose
2010-08-21 11:08:06
A:
If you are on a tiny embedded system where it matters, you can link your own app into the busybox binary, then you can call its functions without any dynamic linker at all.
If you are not, just use system(), or some fork/exec combo.
It is unlikely you'll want to call the utilities so often that performance matters.
MarkR
2010-08-21 07:30:43