public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking problems, mangling ?
@ 1999-12-16  6:36 Roland TTK
  1999-12-16  7:23 ` Eric Meijer
  1999-12-31 22:24 ` Roland TTK
  0 siblings, 2 replies; 12+ messages in thread
From: Roland TTK @ 1999-12-16  6:36 UTC (permalink / raw)
  To: help-gcc

 Hi
I have (succesfully ?) compiled my sources under solaris 2.6 with g++ 2.95 but
I get undefined reference errors when linking. I try to link my object files
with a library which was compiled by the sun C++ compiler. It seems like this
compiler uses a specific mangling grammar, so the linker can't find the
definitions it needs.

I think the mangling grammar is pretty old (1994) so I can't beleive gcc
doesn't emulate it.

Help !

Thanks for your inputs.

-- 
 TTK
 http://www.multimania.com/ttk22

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  6:36 Linking problems, mangling ? Roland TTK
@ 1999-12-16  7:23 ` Eric Meijer
  1999-12-16  8:58   ` Roland TTK
                     ` (2 more replies)
  1999-12-31 22:24 ` Roland TTK
  1 sibling, 3 replies; 12+ messages in thread
From: Eric Meijer @ 1999-12-16  7:23 UTC (permalink / raw)
  To: help-gcc

Roland TTK (hamon@timide.stna.dgac.fr.) wrote:
: 
:  Hi
: I have (succesfully ?) compiled my sources under solaris 2.6 with g++ 2.95 but
: I get undefined reference errors when linking. I try to link my object files
: with a library which was compiled by the sun C++ compiler.

You are trying to do something which cannot work.

: It seems like this
: compiler uses a specific mangling grammar, so the linker can't find the
: definitions it needs.

: I think the mangling grammar is pretty old (1994) so I can't beleive gcc
: doesn't emulate it.

You'd better believe it.  Quote from the g++ faq:

------------------------------------------------------------------------

Why can't g++ code link with code from other C++ compilers?

"Why can't I link g++-compiled programs against libraries compiled by
some other C++ compiler?"

Some people think that, if only the FSF and Cygnus Support folks would
stop being stubborn and mangle names the same way that, say, cfront
does, then any g++-compiled program would link successfully against
any cfront-compiled library and vice versa. Name mangling is the least
of the problems. Compilers differ as to how objects are laid out, how
multiple inheritance is implemented, how virtual function calls are
handled, and so on, so if the name mangling were made the same, your
programs would link against libraries provided from other compilers
but then crash when run. For this reason, the ARM encourages compiler
writers to make their name mangling different from that of other
compilers for the same platform. Incompatible libraries are then
detected at link time, rather than at run time.

------------------------------------------------------------------------

This means that you need to compile all C++ source in an application
with one and the same compiler.  With C libraries this problem generally
doesn't exist.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@pebbles.chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  7:23 ` Eric Meijer
@ 1999-12-16  8:58   ` Roland TTK
  1999-12-16 11:57     ` Dave Sieber
                       ` (2 more replies)
  1999-12-16 11:06   ` Mike Albaugh
  1999-12-31 22:24   ` Eric Meijer
  2 siblings, 3 replies; 12+ messages in thread
From: Roland TTK @ 1999-12-16  8:58 UTC (permalink / raw)
  To: help-gcc

Eric Meijer a dit:
 >You are trying to do something which cannot work.
Yuk !

 >This means that you need to compile all C++ source in an application with
 >one and the same compiler.  With C libraries this problem generally doesn't
 >exist.
Thanks a lot for your help. But ...
I have to use these libraries and I don't have the source code so I can't
recompile them with gcc. So the solution should be to compile my sources with
the sun C++ compiler. But this one doesn't have the STL. So I tried to compile
the libstdc++ in order to emulate the STL.
Alas the sun compiler was unable to do it because libstdc++ sources contain
too many gcc specific things.

So I'm f---ed  :(

Or maybe I could find another implementation of the STL ??

Thanks.
-- 
 TTK
 http://www.multimania.com/ttk22

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  7:23 ` Eric Meijer
  1999-12-16  8:58   ` Roland TTK
@ 1999-12-16 11:06   ` Mike Albaugh
  1999-12-31 22:24     ` Mike Albaugh
  1999-12-31 22:24   ` Eric Meijer
  2 siblings, 1 reply; 12+ messages in thread
From: Mike Albaugh @ 1999-12-16 11:06 UTC (permalink / raw)
  To: help-gcc

Eric Meijer (tgakem@pebbles.chem.tue.nl) wrote:

: [...], and so on, so if the name mangling were made the same, your
: programs would link against libraries provided from other compilers
: but then crash when run. For this reason, the ARM encourages compiler
: writers to make their name mangling different from that of other
: compilers for the same platform. Incompatible libraries are then
: detected at link time, rather than at run time.

: ------------------------------------------------------------------------

: This means that you need to compile all C++ source in an application
: with one and the same compiler.  With C libraries this problem generally
: doesn't exist.

	Beg to differ. On _many_ platforms, the C libraries from
different vendors (and even from different switch settings to the
same compiler) can and do differ in such things as parameter types,
structure layouts, etc. Heck MSVC's "intrinsic" functions disagree
with their own .h files, sometimes :-) Anyway, the result of these
"bleeding ends" is not typically detected at link time, but either
at compile time (_if_ the programmer cranks warnings up high enough
_and_ the .h files are complete and correct) or at run-time, where
they manifest themselves as obscure behavior.

						Mike
| albaugh@agames.com, speaking only for myself

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  8:58   ` Roland TTK
@ 1999-12-16 11:57     ` Dave Sieber
  1999-12-31 22:24       ` Dave Sieber
  1999-12-17 11:52     ` David C.
  1999-12-31 22:24     ` Roland TTK
  2 siblings, 1 reply; 12+ messages in thread
From: Dave Sieber @ 1999-12-16 11:57 UTC (permalink / raw)
  To: help-gcc

Roland TTK wrote:

> Or maybe I could find another implementation of the STL ??

Take a look at http://www.stlport.org/

--
dave

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  8:58   ` Roland TTK
  1999-12-16 11:57     ` Dave Sieber
@ 1999-12-17 11:52     ` David C.
  1999-12-31 22:24       ` David C.
  1999-12-31 22:24     ` Roland TTK
  2 siblings, 1 reply; 12+ messages in thread
From: David C. @ 1999-12-17 11:52 UTC (permalink / raw)
  To: help-gcc

hamon@timide.stna.dgac.fr. (Roland TTK) writes:
> 
> Or maybe I could find another implementation of the STL ??

Have you checked to see if you can get an updated compiler from Sun?
Their "Visual Workshop C++" package
( http://www.sun.com/workshop/visual/spec.html ) claims to be ISO
compilant, which means it should have STL support.

I suggest downloading a 30-day trial version (from Sun's web site) to
see if it's compatible with the library you want to use.  If it is, then
you may want to consider purchasing one or more licenses.

Unless/until your library vendor releases a gcc version, I don't think
you many other choices.  (If you're not using too much of the STL, you
might be able to write some quick-and-dirty implementations of the
templates you need, but that may end up being more work than it's
worth.)

-- David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-17 11:52     ` David C.
@ 1999-12-31 22:24       ` David C.
  0 siblings, 0 replies; 12+ messages in thread
From: David C. @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

hamon@timide.stna.dgac.fr. (Roland TTK) writes:
> 
> Or maybe I could find another implementation of the STL ??

Have you checked to see if you can get an updated compiler from Sun?
Their "Visual Workshop C++" package
( http://www.sun.com/workshop/visual/spec.html ) claims to be ISO
compilant, which means it should have STL support.

I suggest downloading a 30-day trial version (from Sun's web site) to
see if it's compatible with the library you want to use.  If it is, then
you may want to consider purchasing one or more licenses.

Unless/until your library vendor releases a gcc version, I don't think
you many other choices.  (If you're not using too much of the STL, you
might be able to write some quick-and-dirty implementations of the
templates you need, but that may end up being more work than it's
worth.)

-- David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  7:23 ` Eric Meijer
  1999-12-16  8:58   ` Roland TTK
  1999-12-16 11:06   ` Mike Albaugh
@ 1999-12-31 22:24   ` Eric Meijer
  2 siblings, 0 replies; 12+ messages in thread
From: Eric Meijer @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Roland TTK (hamon@timide.stna.dgac.fr.) wrote:
: 
:  Hi
: I have (succesfully ?) compiled my sources under solaris 2.6 with g++ 2.95 but
: I get undefined reference errors when linking. I try to link my object files
: with a library which was compiled by the sun C++ compiler.

You are trying to do something which cannot work.

: It seems like this
: compiler uses a specific mangling grammar, so the linker can't find the
: definitions it needs.

: I think the mangling grammar is pretty old (1994) so I can't beleive gcc
: doesn't emulate it.

You'd better believe it.  Quote from the g++ faq:

------------------------------------------------------------------------

Why can't g++ code link with code from other C++ compilers?

"Why can't I link g++-compiled programs against libraries compiled by
some other C++ compiler?"

Some people think that, if only the FSF and Cygnus Support folks would
stop being stubborn and mangle names the same way that, say, cfront
does, then any g++-compiled program would link successfully against
any cfront-compiled library and vice versa. Name mangling is the least
of the problems. Compilers differ as to how objects are laid out, how
multiple inheritance is implemented, how virtual function calls are
handled, and so on, so if the name mangling were made the same, your
programs would link against libraries provided from other compilers
but then crash when run. For this reason, the ARM encourages compiler
writers to make their name mangling different from that of other
compilers for the same platform. Incompatible libraries are then
detected at link time, rather than at run time.

------------------------------------------------------------------------

This means that you need to compile all C++ source in an application
with one and the same compiler.  With C libraries this problem generally
doesn't exist.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@pebbles.chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16 11:57     ` Dave Sieber
@ 1999-12-31 22:24       ` Dave Sieber
  0 siblings, 0 replies; 12+ messages in thread
From: Dave Sieber @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Roland TTK wrote:

> Or maybe I could find another implementation of the STL ??

Take a look at http://www.stlport.org/

--
dave

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16 11:06   ` Mike Albaugh
@ 1999-12-31 22:24     ` Mike Albaugh
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Albaugh @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Eric Meijer (tgakem@pebbles.chem.tue.nl) wrote:

: [...], and so on, so if the name mangling were made the same, your
: programs would link against libraries provided from other compilers
: but then crash when run. For this reason, the ARM encourages compiler
: writers to make their name mangling different from that of other
: compilers for the same platform. Incompatible libraries are then
: detected at link time, rather than at run time.

: ------------------------------------------------------------------------

: This means that you need to compile all C++ source in an application
: with one and the same compiler.  With C libraries this problem generally
: doesn't exist.

	Beg to differ. On _many_ platforms, the C libraries from
different vendors (and even from different switch settings to the
same compiler) can and do differ in such things as parameter types,
structure layouts, etc. Heck MSVC's "intrinsic" functions disagree
with their own .h files, sometimes :-) Anyway, the result of these
"bleeding ends" is not typically detected at link time, but either
at compile time (_if_ the programmer cranks warnings up high enough
_and_ the .h files are complete and correct) or at run-time, where
they manifest themselves as obscure behavior.

						Mike
| albaugh@agames.com, speaking only for myself

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Linking problems, mangling ?
  1999-12-16  8:58   ` Roland TTK
  1999-12-16 11:57     ` Dave Sieber
  1999-12-17 11:52     ` David C.
@ 1999-12-31 22:24     ` Roland TTK
  2 siblings, 0 replies; 12+ messages in thread
From: Roland TTK @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Eric Meijer a dit:
 >You are trying to do something which cannot work.
Yuk !

 >This means that you need to compile all C++ source in an application with
 >one and the same compiler.  With C libraries this problem generally doesn't
 >exist.
Thanks a lot for your help. But ...
I have to use these libraries and I don't have the source code so I can't
recompile them with gcc. So the solution should be to compile my sources with
the sun C++ compiler. But this one doesn't have the STL. So I tried to compile
the libstdc++ in order to emulate the STL.
Alas the sun compiler was unable to do it because libstdc++ sources contain
too many gcc specific things.

So I'm f---ed  :(

Or maybe I could find another implementation of the STL ??

Thanks.
-- 
 TTK
 http://www.multimania.com/ttk22

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Linking problems, mangling ?
  1999-12-16  6:36 Linking problems, mangling ? Roland TTK
  1999-12-16  7:23 ` Eric Meijer
@ 1999-12-31 22:24 ` Roland TTK
  1 sibling, 0 replies; 12+ messages in thread
From: Roland TTK @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

 Hi
I have (succesfully ?) compiled my sources under solaris 2.6 with g++ 2.95 but
I get undefined reference errors when linking. I try to link my object files
with a library which was compiled by the sun C++ compiler. It seems like this
compiler uses a specific mangling grammar, so the linker can't find the
definitions it needs.

I think the mangling grammar is pretty old (1994) so I can't beleive gcc
doesn't emulate it.

Help !

Thanks for your inputs.

-- 
 TTK
 http://www.multimania.com/ttk22

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-16  6:36 Linking problems, mangling ? Roland TTK
1999-12-16  7:23 ` Eric Meijer
1999-12-16  8:58   ` Roland TTK
1999-12-16 11:57     ` Dave Sieber
1999-12-31 22:24       ` Dave Sieber
1999-12-17 11:52     ` David C.
1999-12-31 22:24       ` David C.
1999-12-31 22:24     ` Roland TTK
1999-12-16 11:06   ` Mike Albaugh
1999-12-31 22:24     ` Mike Albaugh
1999-12-31 22:24   ` Eric Meijer
1999-12-31 22:24 ` Roland TTK

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).