|Sharing code and data in multi-language environments email@example.com (1993-05-24)|
|Re: Sharing code and data in multi-language environments firstname.lastname@example.org (1993-05-24)|
|Re: Sharing code and data in multi-language environments email@example.com (1993-05-25)|
|Re: Sharing code and data in multi-language environments firstname.lastname@example.org (1993-05-27)|
|From:||email@example.com (Henry Spencer)|
|Keywords:||design, C++, PL/I|
|Organization:||U of Toronto Zoology|
|Date:||Thu, 27 May 1993 19:54:37 GMT|
In article 93-05-113 firstname.lastname@example.org 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
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, email@example.com utzoo!henry
Return to the
Search the comp.compilers archives again.