I'm not asking about WHEN to link different programming langauges.
This is quite a general question but I'm personally working on Linux.
What I want to understand is the process by which different programming languages can be combined, I found a good article on combining C/C++/Fortran: http://www-h.eng.cam.ac.uk/help/tpl/languages/mixinglanguages.html.
From what I understand most compilers perform two stages:
Translating the language files into object files which contain machine code but still contain some symbols (possibly function names?)
Linking the object files together, only at this stage the Linker checks that the functions in the object files are callable.
I think that the problem with combining different languages is name mangling which means that the names of the functions are changed when they are turned into object code.
The questions are:
Can't you somehow discover the mangled function names beforehand and than specify them explicitly in the programming language or better off, isn't there a software that already does that?
I don't understand completely how dynamic libraries are linked but can different languages interact by the same method that programs interact with dynamic libraries?
p.s The main intent is to call functions written in another language.