One of the features missing in bun:ffi is inferring types for symbols from header files. This would let you import C libraries in JavaScript/TypeScript directly, without having to configure bindings. We embed TinyCC for FFI, but TinyCC doesn't expose a way to read the types for exported symbols. Currently, it looks like this: import { dlopen, FFIType, suffix } from "bun:ffi"; // `suffix` is either "dylib", "so", or "…
new_clib("/system/lib64/liblog.so", "log")
ffi.cdef[[int __android_log_print(int priority, const char *tag, const char *msg);]]
ffi.log.__android_log_print(5, "TEST_TAG", "Hello from FFI")
I can't say I'm familiar with Bun, but I've used a similar syntax to the example you provided of the current Bun syntax when working with Frida (https://frida.re). I agree it leaves something to be desired and indeed it would be cool if Aro could do this in the future.