Multi language programming

guerin@IRO.UMontreal.CA (Frederic Guerin)
Fri, 3 Nov 1995 17:15:01 GMT

          From comp.compilers

Related articles
Multi language programming guerin@IRO.UMontreal.CA (1995-11-03)
Re: Multi language programming martelli@cadlab.it (1995-11-12)
Multi language programming dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-11-13)
Re: Multi language programming guerin@IRO.UMontreal.CA (1995-11-17)
Re: Multi language programming shankar@engr.sgi.com (1995-11-20)
Re: Multi language programming Robert.Corbett@Eng.Sun.COM (1995-11-21)
Re: Multi language programming dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-11-27)
| List of all articles for this month |

Newsgroups: comp.compilers
From: guerin@IRO.UMontreal.CA (Frederic Guerin)
Keywords: question, comment
Organization: Universite de Montreal
Date: Fri, 3 Nov 1995 17:15:01 GMT

Hello compiler wiz,


Suppose I got a software written using 2 different languages, say A and C,
where C is a fixed language. How should A be designed when it
comes to interaction with C so that the software can be compiled on
many platform/machines without modifications ( or as little as possible ) ?


There is the C++ way of doing :


extern "ALanguage"
{
// some declarations
}


This works fine if every compilers of that language use a common naming
and calling convention, given a platform/machine ( or if the compiler
for ALanguage is included which is the case for C with respect to C++ ).


Hence the question :


Can it be assumed that for a given modular language like C, FORTRAN, MODULA
the naming and calling convention is unique for a given platform/machine ?


But there are languages which for sure do not follow this principle, e.g.
C++ which use a name mangling which can be in principle specific to a
given compiler.


Hence another question :


How A should be designed to handle such a situation ?


P.S. I guess this situation requires some code modification
but how can it be minimal ?


Thanks to everyone,
I'll post a summary of mail received,


Frederic
[Sad to report that I've known lots of cases where different compilers for the
same language on the same machine use different calling sequences and name
mangles. Even C compilers usually mangle a little, e.g. adding _ before
the name. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.