Re: Name decoration
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 08/17/04
- Next message: Igor Tandetnik: "Re: createDIBsection failed"
- Previous message: Igor Tandetnik: "Re: Sorting based on locale in c++"
- In reply to: Michael Hoffmann: "Re: Name decoration"
- Next in thread: Michael Hoffmann: "Re: Name decoration"
- Reply: Michael Hoffmann: "Re: Name decoration"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 15:10:07 -0400
Michael Hoffmann wrote:
> [...] My linker works like this:
> All functions found in the OBJs are exported by the import libaries without
> the underscore being removed again.[...]
I have hard time understanding that sentence. "without the underscore
being removed again". So, is it being removed or not? Why "again"? When
was it already removed? Are the functions without the underscore or with
the underscore? When your compiler creates the code, couldn't it just add
underscores to the functions it knows come from the C side? Does it know
whether they are from the C side? If it can't resolve the symbol without
the underscore, could it simply add the underscore and try resolving it
again?
> Is there a reason why the _ is added?
I cannot recall seeing or hearing any particular reason except that at
some point it made a difference when linking Pascal (or FORTRAN) libraries
along with C libraries just to make sure that C functions were resolved
from the C object modules. So, the compiler always adds the underscores,
and there is no problem for any linker -- C code that needs a C function
also has the function's name prepended with an underscore, thus a match
can easily be made.
For linking with functions from other languages C (and C++) has the
'linkage specification' mechanism. Symmetrically, other languages _may_
have similar mechanisms for linking in C libraries.
Victor
- Next message: Igor Tandetnik: "Re: createDIBsection failed"
- Previous message: Igor Tandetnik: "Re: Sorting based on locale in c++"
- In reply to: Michael Hoffmann: "Re: Name decoration"
- Next in thread: Michael Hoffmann: "Re: Name decoration"
- Reply: Michael Hoffmann: "Re: Name decoration"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|