Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

LLVM languages can all natively link with C code, since any LLVM bytecode can directly call other LLVM bytecode. So Zig, C++, Obj-C, Swift and Rust can all be compiled together.

But C compatibility is everywhere. Almost every language has a FFI (foreign function interface) for C code. C interop shows up in every language because at the end of the day every language needs to be able to talk to the operating system. For example, to read and write files your language needs to call functions in libc (or equivalent). And that library is written in C.

So, Nodejs can call C via has native modules & NAPI. Java can call C through JNI. Ruby has the ffi gem. Python, Luajit, Go, C#, ... the list goes on. They all have a mechanism to call C code.

If you're looking for another language that can live alongside your C code, you can choose any.



However, one typically needs to write out a description of the “C” interface. And if the “C” header files are large it can be a lot of work. For example, I’m unaware of any complete Python bindings to the win32api, user32, kernel32, gdi32.


Can we use NAPI and JNI together to bridge Node and Java/Android applications


Can we use NAPI and JNI together to bridge nodejs and Java/Android


thank you so much! I didnt know that about LLVM. and I love Swift!!!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: