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

The linker stitches object files together, regardless of their origin. If a compiler directly outputs a finalized artifact, then it would be impossible to add code written in other programming languages into the mix unless the compiler also doubles as a linker.


> then it would be impossible to add code written in other programming languages into

Is this really that important that we cannot skip this requirement?


You might be surprised how often multi-language programs appear. Basically all of modern day Python for starters. But also a number of important numerical libraries for C are actually written in Fortran.


> You might be surprised how often multi-language programs appear. Basically all of modern day Python for starters. But also a number of important numerical libraries for C are actually written in Fortran.

In my experience, the most common use case is C-based programs with some C++ sprinkled in (especially if you need the C code to be compiled exclusively by a C compiler in order to maintain C semantics).


I thought it is done by ffi




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

Search: