473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Difference in mangling

Hello,

I am using VisiBroker 4.0 on RedHat 8.0 with GCC 3.2.

When I do a "nm liborb_r.so | grep _invoke", I get some output. The symbol
of my intrest is manged as below,
002f6270 T _preinvoke__12CORBA_ObjectPCc

Now when I build an app that links to liborb_r.so, and uses the _preinvoke
API, GCC mangles this symbol as follows,
U _ZN12CORBA_Object10_preinvokeEPKc

In short, (as mangling is compiler dependent) my compiler is mangling the
symbols in a way different from the compiler that was used to build the
library I am trying to link to. As a result I am getting an un-resolved
symbol error. How do I solve this?

Thanks in advance,

Loma

Jul 19 '05 #1
9 2565
"lomat" <at****@ideas.com> wrote...
I am using VisiBroker 4.0 on RedHat 8.0 with GCC 3.2.

When I do a "nm liborb_r.so | grep _invoke", I get some output. The symbol
of my intrest is manged as below,
002f6270 T _preinvoke__12CORBA_ObjectPCc

Now when I build an app that links to liborb_r.so, and uses the _preinvoke
API, GCC mangles this symbol as follows,
U _ZN12CORBA_Object10_preinvokeEPKc

In short, (as mangling is compiler dependent) my compiler is mangling the
symbols in a way different from the compiler that was used to build the
library I am trying to link to. As a result I am getting an un-resolved
symbol error. How do I solve this?


Name mangling is compiler-specific. If two different compilers are
used to build the library and the executable, they (the library and
the executable) are not guaranteed to be compatible. C++ is only
portable on the source code level. There are two ways to solve your
problem: recompile both the library and the executable using the
same compiler OR build some kind of interface guaranteed not to have
its name mangled, e.g. by declaring it 'extern "C" '.

Victor
Jul 19 '05 #2
lomat> In short, (as mangling is compiler dependent) my compiler is
lomat> mangling the symbols in a way different from the compiler that
lomat> was used to build the library I am trying to link to. As a
lomat> result I am getting an un-resolved symbol error. How do I solve
lomat> this?

Suppose the names happened to be mangled the same way. What makes
you think that the compiler you are using to compile your program
would use the same binary calling conventions as the compiler that
was used to build the library?

--
Andrew Koenig, ar*@acm.org
Jul 19 '05 #3


- I do not have source code for liborb_r.so (it comes with Borland
VisiBroker) and we have purchased it.
- There's a problem with writing a bridge. I am not sure if I can explain it
well. *I do not know all the functions that my application will use from
this library*. It's a CORBA thing. For e.g. the function _preinvoke() I
mentioned in my earlier example isn't being called from my code directly. I
call some API which (I think) in turn call this _preinvoke() internally.

Any other suggestions? Thanks!

Loma

"Victor Bazarov" <v.********@attAbi.com> wrote in message
news:vi************@corp.supernews.com...
"lomat" <at****@ideas.com> wrote...
I am using VisiBroker 4.0 on RedHat 8.0 with GCC 3.2.

When I do a "nm liborb_r.so | grep _invoke", I get some output. The symbol of my intrest is manged as below,
002f6270 T _preinvoke__12CORBA_ObjectPCc

Now when I build an app that links to liborb_r.so, and uses the _preinvoke API, GCC mangles this symbol as follows,
U _ZN12CORBA_Object10_preinvokeEPKc

In short, (as mangling is compiler dependent) my compiler is mangling the symbols in a way different from the compiler that was used to build the
library I am trying to link to. As a result I am getting an un-resolved
symbol error. How do I solve this?


Name mangling is compiler-specific. If two different compilers are
used to build the library and the executable, they (the library and
the executable) are not guaranteed to be compatible. C++ is only
portable on the source code level. There are two ways to solve your
problem: recompile both the library and the executable using the
same compiler OR build some kind of interface guaranteed not to have
its name mangled, e.g. by declaring it 'extern "C" '.

Victor

Jul 19 '05 #4
This didn't strike me earlier, I am not a compiler internals pro yet.
You have any possible solution(s) ?

Loma

"Andrew Koenig" <ar*@acm.org> wrote in message
news:yu**************@tinker.research.att.com...
lomat> In short, (as mangling is compiler dependent) my compiler is
lomat> mangling the symbols in a way different from the compiler that
lomat> was used to build the library I am trying to link to. As a
lomat> result I am getting an un-resolved symbol error. How do I solve
lomat> this?

Suppose the names happened to be mangled the same way. What makes
you think that the compiler you are using to compile your program
would use the same binary calling conventions as the compiler that
was used to build the library?

--
Andrew Koenig, ar*@acm.org

Jul 19 '05 #5

There really isn't any other good way than recompiling everything with
the same compiler. The problem is that compilerss are not required to
name mangle the same, and therefor you can not gaurante that object code
from two different compilers will work. In fact g++ 3.1 and g++ 3.2
object code isn't even compatible, so it's not just different compilers
but possible different versions too.

lomat wrote:

- I do not have source code for liborb_r.so (it comes with Borland
VisiBroker) and we have purchased it.
- There's a problem with writing a bridge. I am not sure if I can explain it
well. *I do not know all the functions that my application will use from
this library*. It's a CORBA thing. For e.g. the function _preinvoke() I
mentioned in my earlier example isn't being called from my code directly. I
call some API which (I think) in turn call this _preinvoke() internally.

Any other suggestions? Thanks!

Loma

Jul 19 '05 #6
lomat wrote:
- I do not have source code for liborb_r.so (it comes with Borland
VisiBroker) and we have purchased it.
- There's a problem with writing a bridge. I am not sure if I can
explain it well. *I do not know all the functions that my application
will use from this library*. It's a CORBA thing. For e.g. the function
_preinvoke() I mentioned in my earlier example isn't being called from
my code directly. I call some API which (I think) in turn call this
_preinvoke() internally.

Any other suggestions? Thanks!


Either find out which compiler the library was compiled with and use the
same one or ask the manufacturer if he can compile the library with
your compiler.

Jul 19 '05 #7
Victor> There are two ways to solve your problem: recompile both the
Victor> library and the executable using the same compiler OR build
Victor> some kind of interface guaranteed not to have its name
Victor> mangled, e.g. by declaring it 'extern "C" '.

That second alternative doesn't necessarily work, because even
if two compilers use the same naming conventions, they might
use different calling sequences.

The only solution is to use two compilers that are known to be
mutually compatible.

--
Andrew Koenig, ar*@acm.org
Jul 19 '05 #8
In article <vi************@corp.supernews.com>,
Victor Bazarov <v.********@attAbi.com> wrote:
build some kind of interface guaranteed not to have
its name mangled, e.g. by declaring it 'extern "C" '.


Actually, that's not guaranteed, but an implementation
detail. That said, it does seem universally implemented
as not having its name mangled.
--
Greg Comeau/ 4.3.0.1: FULL CORE LANGUAGE, INCLUDING TC1
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 19 '05 #9
In article <bg**********@panix5.panix.com>,
Greg Comeau <co****@comeaucomputing.com> wrote:
In article <vi************@corp.supernews.com>,
Victor Bazarov <v.********@attAbi.com> wrote:
build some kind of interface guaranteed not to have
its name mangled, e.g. by declaring it 'extern "C" '.


Actually, that's not guaranteed, but an implementation
detail. That said, it does seem universally implemented
as not having its name mangled.


Which I should also point out does not guarantee that
the function can still be called. After all, not even
two C compilers may be able to call it, so there is
certainly no requirement that a C++ compiler must be
able to. So tred cautiously, and be aware of the
compilers, their options settings, and what the respective
vendors say about this.
--
Greg Comeau/ 4.3.0.1: FULL CORE LANGUAGE, INCLUDING TC1
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nimmi Srivastav | last post by:
Once and for all can someone kindly tell me the difference between C and C++ linkage. I thought I understood it till someone showed me the other day that C functions, that would ordinarily require...
6
by: yyy | last post by:
my question is rather theoretical than practical in the pure programming aspect... is "name mangling" the same as "name decorating" ? browsing the web, you might find multiple people saying...
10
by: Johnny Lee | last post by:
Hi, I'm new in python and I was wondering what's the difference between the two code section below: (I) class TestResult: _pass_ = "pass" _fail_ = "fail" _exception_ = "exception"
1
by: noleander | last post by:
I need to use a library supplied by someone else: libjpeg.lib. This is a plain C library. I do not have the source code. I do have the header *.h files. When I run dumpbin on the libjpeg.lib,...
2
by: Brian van den Broek | last post by:
Hi all, I've the following code snippet that puzzles me: class Base(object): __v, u = "Base v", "Base u" def __init__(self): print self.__v, self.u class Derived(Base):
6
by: David Wade | last post by:
Folks, Does any one know of any "name mangling" software that allows standard C with long names to be linked? Any suggestions for a better place to look? I have tried putting various searchs...
45
by: anto frank | last post by:
hi friends, is ther any difference in array in c and array in c++?
4
by: jason.cipriani | last post by:
Does anybody know if C++0x is going to change C++ name mangling at all? Such as, standardizing name mangling instead of leaving it up to the compiler? Jason
14
by: Megalo | last post by:
why not make "name mangling" of C++ standard so should be possible to call the classes and the functions of C++ from other C++ compiler thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.