extern (c)

user1234 user1234 at 12.de
Wed Oct 11 12:54:53 UTC 2023


On Wednesday, 11 October 2023 at 12:36:58 UTC, Paul wrote:
> What does the extern (c) attribute(?) do?
> Does it tell the compiler/linker to build the function like a C 
> compiler would build a C function? If so what does that mean?
> Does it tell the compiler/linker to let C functions know it 
> exists? If so what does that mean?
> Is it meant for the compiler or linker or both?
>
> Thanks for any assistance.

`extern(C)` on module level functions affect the mangling and the 
calling convention.

- Mangling is used by the linker to link symbols between objects.
- Calling convention affects the compiler backend in how code is 
generated for a CALL instruction.


More information about the Digitalmars-d-learn mailing list