cross-compiler and C++ mangling

Efrat NA <Efrat_NA@netvision.net.il>
5 Mar 1997 21:38:17 -0500

          From comp.compilers

Related articles
cross-compiler and C++ mangling Efrat_NA@netvision.net.il (Efrat NA) (1997-03-05)
Re: cross-compiler and C++ mangling john.currier@checksol.com (1997-03-21)
| List of all articles for this month |

From: Efrat NA <Efrat_NA@netvision.net.il>
Newsgroups: comp.compilers,comp.lang.c++.moderated
Date: 5 Mar 1997 21:38:17 -0500
Organization: Efrat Future Technology LTD
References: <5f1078$nr3@netlab.cs.rpi.edu> <5f5vbh$oej@netlab.cs.rpi.edu>
Keywords: C++, design

Efrat NA <Efrat_NA@netvision.net.il> writes:
|> We have a distributed system, written in C++, which is currently
|> compiled by the g++ compiler. We try to combine CORBA into our system.
|> The CORBA products force us to compile by the SPARCworks C++ compiler on
|> the UNIX platforms.
|> As CORBA is a big step already, we do not want move the whole system to
|> a new compiler at the time being.
|> And here comes the problem:
|> The mangling is different, and therefore we expect troubles while
|> combining g++ compiled components with SPARCworks components.


James Kanze wrote:
> The mangling isn't the only thing that is different. G++ and SPARCworks
> use completely different class layouts. Which means that if the
> mangling were the same, you'd get a core dump on the first virtual
> function call. (Thanks to different mangling, you get an error at link
> time instead.)
>
> In practice, different manglings are recommended practice for compilers
> using incompatible conventions.


You are right about the different class-layouts. But what if we do not
want to inherit from the "g++ class" but only to contain the "g++
class" in our "SPARCworks class". We do not even need strong
containment. That way, it is actually the g++ compiled library that
allocates space for the g++-object contained in the
SPARCwork-object. Doesn't it solve the layouts-problem, so just the
mangling-problem is left?


Example:


class BaseClass{
virtual SomeFunction() {do something;}
};


class g++class : public BaseClass {
SomeFunction() {do something else;}
...
}


class SPARCworkClass {
g++Class *class_pointer;
SPARCworkClass() {class_pointer = new g++Class;}
SomeFunction() {class_pointer->SomeFunction();}
};


Is it goint to work? If it is - we are still left with the lnking
problem. Any suggestion for that?


|> I beleive the cross-compiler problem is an interesting problem for
|> itself, and I would appreciate getting anyone's comments for the
|> subject.


> For the moment, my impression is that it won't happen soon. Still, I
> know that some vendors (Sun, for example) ARE trying to establish an API
> convention for C++ on their platforms; if all of the compilers for the
> platform adhere, you win. For this to happen, however, the standard
> needs to be a bit stable.


I heard Bjarne Stroustrup has a new book, with the suggested standard
for the compilers. Do anyone know the name of the book, and the
publishing company?


            [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
            [ about comp.lang.c++.moderated. First time posters: do this! ]
[The book's probably "The C++ Programming Language : Language, Library and
Design" -John]
--


Post a followup to this message

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