Newsgroups: comp.lang.c++
Path: utzoo!utgpu!watserv1!watmath!watmsg.waterloo.edu!gjditchfield
From: gjditchfield@watmsg.waterloo.edu (Glen Ditchfield)
Subject: Re: Portability of compiled libraries (was Re: Name Mangling)
Message-ID: <1991May3.145356.3424@watmath.waterloo.edu>
Summary: extern "cfront"
Sender: news@watmath.waterloo.edu (News Owner)
Organization: University of Waterloo
References: <1991May1.112346.13948@fmrco> <42018@ucbvax.BERKELEY.EDU>
Date: Fri, 3 May 1991 14:53:56 GMT
Lines: 28

In article <1991May1.112346.13948@fmrco> harold@fmrco (Harold Naparst) writes:
>To what extent can a library compiled with compiler A be used
>by a program compiled with compiler B ?
>My question concerns the uniqueness of the name mangling scheme.

In article <42018@ucbvax.BERKELEY.EDU> jbuck@janus.Berkeley.EDU (Joe Buck) writes:
>... name mangling is the least of your problems.  You also need for both
>compilers to implement virtual functions in the same way...  In general,
>there are tricks that can be played by compilers that go directly to
>assembly language that can't be used by compilers that go to C (trivial
>example: use a specified register to contain the "this" pointer), and it's
>unreasonable to expect the writers of such compilers to give up
>competitive advantages to be compatible with cfront.

The string literal in a linkage specification is usually though of as a
language name, but it can just as easily be a compiler name.  So, the GNU
people could solve this problem* by providing a "cfront" linkage.
    extern "cfront" {
        // Interface for library compiled by AT&T C++
    }

--------
* ... if they have time on their hands, and if AT&T has documented the
  interface to cfront-compiled code.  Neither seems likely.

    Glen Ditchfield  gjditchfield@violet.uwaterloo.ca  Office: DC 2517
Dept. of Computer Science, U of Waterloo, Waterloo, Ontario, Canada, N2L 3G1
	      These opinions have not been tested on animals.
