Bug 23025 – ImportC: duplicate symbol for tentative definition and definition of variable
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Mac OS X
Creation time
2022-04-17T05:59:05Z
Last change time
2022-04-19T06:25:13Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
dave287091
Comments
Comment #0 by dave287091 — 2022-04-17T05:59:05Z
The following C program will fail to link with a duplicate symbol error.
```
const char *s; // tentative definition
const char *s = “hello”; // definition
int puts(const char*);
int main(void){
puts(s);
return 0
}
```
duplicate symbol '_s' in:
dup.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
Comment #1 by dlang-bot — 2022-04-19T05:21:56Z
@WalterBright created dlang/dmd pull request #14010 "fix Issue 23025 - ImportC: duplicate symbol for tentative definition …" fixing this issue:
- fix Issue 23025 - ImportC: duplicate symbol for tentative definition and definition of variable
https://github.com/dlang/dmd/pull/14010
Comment #2 by dlang-bot — 2022-04-19T06:25:13Z
dlang/dmd pull request #14010 "fix Issue 23025 - ImportC: duplicate symbol for tentative definition …" was merged into master:
- 4c053d5bf3c69db248ffede01c3c808e6c299235 by Walter Bright:
fix Issue 23025 - ImportC: duplicate symbol for tentative definition and definition of variable
https://github.com/dlang/dmd/pull/14010