Potential of a compiler that creates the executable at once

Dennis dkorpel at gmail.com
Fri Feb 11 10:16:43 UTC 2022


On Friday, 11 February 2022 at 06:33:20 UTC, Walter Bright wrote:
> Now suppose X.obj and Y.obj both define foo. Link with:
>
>     link X.obj Y.obj A.lib B.lib C.lib
>
> You get a message:
>
>     Multiple definition of "foo", found in X.obj and Y.obj

Don't rely on this when using DMD though, since it likes to place 
all functions in COMDATs, meaning the linker will just pick one 
`foo` instead of raising an error.

https://github.com/dlang/dmd/blob/a176f0359a07fa5a252518b512f3b085a43a77d8/src/dmd/backend/backconfig.d#L303
https://issues.dlang.org/show_bug.cgi?id=15342



More information about the Digitalmars-d mailing list