🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #72461

Re: Will the object code from different languages be compatible?

#72461
From: T. Kurt Bond
Date: Sat, 01 Feb 1992 16:05
42 lines
3036 bytes
In article <1992Jan28.212225.25601@CSD-NewsHost.Stanford.EDU>, 
amorgan@CS.Stanford.EDU (Crunchy Frog) writes:
> 
> Sorry to interrupt the extremely exciting flame war going on, but I have
> a question.  Right now it is rather difficult to combine, say fortran code
> with C, or indeed any language with any other.  This means, for all practical
> purposes, that code must be written in one language only (ignoring cases
> like emacs).  Has any thought been given to the possibility of making the
> GNU language products (when they all come out) able to speak to one another?
> The idea being that I could write some code in C, some in Fortran, some in 
> LISP, compile link and go.  I realize this would be difficult but is it so
> hard that it is not even worth thinking about?

This need not be so difficult.  For instance, VMS has always had a standard
function calling sequence and a set of standard  data structures, so it is not
difficult to call Fortran from Basic or C or Bliss or Cobol or Pascal or PL/1
or Ada, or the other ways around.  Sometimes things get messy when you have to
deal with data structures from one language in another language that doesn't
have builtin support for those data structures, say you want to manipulate a
VAX BASIC array of dynamic-length strings in C, or a linked list of C
structures in VAX FORTRAN, but it can be done.   (It's fun being able to call
VAX BASIC functions that return dynamic length strings from C code, which has
no built-in dynamic lenth strings.)

The fact that is more difficult in other environments is simply a matter of
historical accident: the language implementors had less incentive to use the
same function calling conventions as everybody else.

This is harder to do for something like LISP or Scheme or Prolog or SMALLTALK,
though, since those languages have greatly different internals, with things
like tagged data and garbage collection and Scheme's
call-with-current-continuation.  A lot of LISPs have foreign function call
interfaces, so they can call C, for instance, but for a C program to call a
LISP function is a more complicated matter, since somehow the runtime support
for the LISP function has to be set up.

> We now return you to the ubiquitous discussion of the meaning of 'free'.
> 
> Alan

--
T. Kurt Bond, tkb@mtnet2.wvnet.edu  or  os360051@wvnvms.wvnet.edu
Technical Details
Message-ID: <1992Jan30.152628.2222@wvnvms.wvnet.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!cs.wvu.wvnet.edu!wvnvms.wvnet.edu!os360051
References: <1992Jan28.212225.25601@CSD-NewsHost.Stanford.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,3e4536325cf8c41f
X-Google-Attributes: gid1025b4,public
X-Google-ArrivalTime: 1992-02-01 08:24:33 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!cs.wvu.wvnet.edu!wvnvms.wvnet.edu!os360051
From: os360051@wvnvms.wvnet.edu (T. Kurt Bond)
Newsgroups: gnu.misc.discuss
Subject: Re: Will the object code from different languages be compatible?
Message-ID: <1992Jan30.152628.2222@wvnvms.wvnet.edu>
Date: 1 Feb 92 16:05:32 GMT
References: <1992Jan28.212225.25601@CSD-NewsHost.Stanford.EDU>
Distribution: gnu
Organization: West Virginia Network for Educational Telecomputing
Lines: 42