extern (C) private linking issue
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Feb 26 09:38:01 PST 2007
Will DeVore (Quartz) wrote:
> I wonder why then it works under linux though. The linux linker seems to be able to identify the correct private function.
It _doesn't_ work. Both functions are put in section
.gnu.linkonce.ttext, which means the linker will throw away one of them
and silently use the other in its place.
In this case, I prefer Optlink behavior.
> I don't really know how Optlink works but I would say it is having
problems making unique mangled names inside of modules with private
attributes. Hmm...
No, Optlink does exactly what it should do in this instance.
_DMD_ has problems making unique mangled names of extern(C) functions.
The main problem being that it's not allowed to do so :P.
'extern(C)' means it has to use the C mangling as well as the C calling
convention, and C mangling means no mangling at all (except, on Windows,
a leading '_' -- not much help).
More information about the Digitalmars-d
mailing list