POV-Ray : Newsgroups : povray.off-topic : Linking : Re: Linking Server Time
1 Jul 2024 02:31:53 EDT (-0400)
  Re: Linking  
From: clipka
Date: 28 May 2016 23:27:15
Message: <574a6193@news.povray.org>
Am 28.05.2016 um 14:03 schrieb Le_Forgeron:

> Then came C. The usual C compiler was in charge of generating the suitable assembly
( that's why .c can still be transformed in .s before becoming a .o )
> 
> C came with its own way to transform its symbols into the symbols supported by
assembly : mangling.

Uh... no, generally C does not have any name mangling. The symbols are
taken as-is. (Microsoft Windows programs being an exception.)

Which is why you can't overload functions in C.

> C++, because it allows even more characters in its symbols, has its own mangling
too, more complex, and not always compatible with the C mangle.
> That's why you can encounter
> 
> extern "C" {
> /* C code here */
> }
> 
> statements: to inform the mangler to use the C version instead of the C++ one.

Equally importantly, it also informs the compiler about the call
conventions to use (what registers to use for parameters, whether the
caller or the callee is responsible for stack cleanup, and the like).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.