Re: Sharing code and data in multi-language environments

henry@zoo.toronto.edu (Henry Spencer)
Thu, 27 May 1993 19:54:37 GMT

          From comp.compilers

Related articles
Sharing code and data in multi-language environments hulaas@lcodec1.epfl.ch (1993-05-24)
Re: Sharing code and data in multi-language environments tmb@arolla.idiap.ch (1993-05-24)
Re: Sharing code and data in multi-language environments prener@watson.ibm.com (1993-05-25)
Re: Sharing code and data in multi-language environments henry@zoo.toronto.edu (1993-05-27)
| List of all articles for this month |
Newsgroups: comp.compilers
From: henry@zoo.toronto.edu (Henry Spencer)
Keywords: design, C++, PL/I
Organization: U of Toronto Zoology
References: 93-05-113
Date: Thu, 27 May 1993 19:54:37 GMT

In article 93-05-113 hulaas@lcodec1.epfl.ch writes:
>... exporting in one language a routine 'foo' with two arguments
>passed by value won't prevent anyone using another language from calling
>the same 'foo' with only one actual argument passed by reference...


It depends on the language. In most modern C++ implementations, in
particular, the argument types are part of the name of the routine (as
emitted into the object module, not as written in the source), and you
can't get the linker to link to it unless the types are right. This is
not just a frill, because it's almost impossible to handle C++'s name
overloading otherwise.


This approach has the advantage that it requires very little cooperation
from the linker: all it really needs is the ability to use long names.


Mind you, there is necessarily a way to suppress this for linkage to C
(etc.), which doesn't use this convention, and then you're back in the
situation Mr. Hulaas describes.


>[PL/I lets you declare that procedures are to use the linkage of other
>languages such as Fortran or Cobol, though it's entirely implementation
>dependent what actually happens. -John]


C++ does likewise, although I suspect that a lot of implementations don't
support any alternate linkage style except "C".
--
Henry Spencer @ U of Toronto Zoology, henry@zoo.toronto.edu utzoo!henry
--


Post a followup to this message

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