linker - linking library built with g 2.95.2 to object files built with gcc 4.6 -


i'm trying reuse old static library built linux gcc 2.95.2. i'm using recent compiler (gcc 4.6) 32bit ubuntu distro. library written in c++. have problems linking against functions encapsulated in classes.

i guess naming of symbols has changed.

http://www.qnx.com/developers/docs/6.3.2/momentics/compatibility/about.html#c++_code: gcc 2.95.3 (from 6.2.1 or 6.3) , gcc 3.3.5 use different c++ abis , have different name mangling. result, can't link c++ binaries (objects, executables, libraries) built gcc 2.95.3 binaries built gcc 3.3.5.

the error output of ld is:

undefined reference `foo1::bar()' (class foo1; member bar)

with tool mn symbols read out. matching symbol named in different way:

bar__4foo1

question: there way rename symbols in library file? or can force ld accept old naming format?

i guess naming of symbols has changed.

correct.

what missing naming has changed a reason, namely code produced g++ 2.95 , g++ 3.3 abi incompatible. if allowed link 2 objects compiled these compilers together, you'd unexplainable crashes.

by changing name mangling, gcc developers have saved trouble of debugging such crashes.

is there way rename symbols in library file?

there is, if succeed that, you'll end said crashes, don't shoot foot off.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -