Hacker News new | ask | show | jobs
by yellowapple 3269 days ago
A growing number of languages are ABI-compatible with C. A small but significant subset of those languages is ABI-compatible with C++. Quite a few languages (Perl 6, Julia, Tcl w/ critcl, pretty much everything that uses libffi AFAICT) are able to do this without having to write full-blown wrappers for a whole C/C++ library (though you still need to wrap specific functions in most cases).
1 comments

Julia JIT compiles C calls via LLVM, so there's no libffi performance overhead (similar to LuaJIT's CFFI, though that does not use LLVM).
Neither does Tcl's critcl AFAIK (I think it just sticks the C code in a Tcl extension and compiles it using the system compiler). My intent there was just to list cases where wrapping a whole C/C++ library is unnecessary, not to imply that Julia uses libffi :)

On that note, LLVM helps a lot here, too. Are there any LLVM-based languages that don't have some degree of C compatibility?

Parse error on my part, excuse the pedantry :) Tcl is such a weird and wonderful language, and I occasionally miss it (though I don't miss working with a GUI written in C++ wrapped around tk).