Re: Urgent: Need info on C++ Linking

From: Malte Starostik (malte.starostik_at_t-online.de)
Date: 10/22/04


Date: Fri, 22 Oct 2004 06:35:05 +0200

sunil schrieb:
> Hi,
> [...] I am completely new
> to C++ linking. Is there some tutorial that can explain the nuances of
> C++ linking? We do links on DIGITAL UNIX, SUN Solaris, IBMS and HP
> UNIX platforms. I compiled same cpp source files on all four platforms
> but was suprised to see that the symbol information differs widely
> across all four platforms. For C/FORTRAN code, it is pretty
> straightforward to look at o/p from nm command and see what global
> (data/function) symbols a given object file/library exports. But that
> doesnt seem to be case with C++. [...]

In C++, symbol names are "mangled" to include not only their plain
names, but also their type. How exactly this is done is
implementation-defined, that's why you see those differences between
toolsets for different platforms. Some versions of nm have an option to
demangle C++ symbol names to human readable form or your toolset might
include something like "c++filt" to pipe nm's output through. Apart
from that, linking C++ objects isn't really any different than linking C
objects. Either way, this is compiler/linker-specific and not a C++
language issue; if you have any further questions about this,
comp.unix.programmer seems to be a more adequate place to me.

Regards,
Malte



Relevant Pages

  • Re: Using a dictionary to pass data to/from embedded python functions
    ... You no doubt needed that for linking, not for compiling (I needed the -L ... we're just talking about different platforms -- probably both ... Unix variants, but with different linking-loader behavior and/or ... /ld.1.html> for more details) I was remiss in not mentioning my ...
    (comp.lang.python)
  • set version of lib
    ... I am looking for a way to set a version id to a lib on different ... platforms. ... On Linux while linking with "ld" I could use a ...
    (comp.programming)
  • Re: freeWrap - dynamically link to Tcl/Tk instead?
    ... with DLLs for different platforms? ... Unfortunately no, as it would contain the compiled zip code and linking to the Tcl/Tk shared library, so the Tcl code would need to be wrapped with a version of freeWrap compiled for the specific platform. ...
    (comp.lang.tcl)