www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23025] New: ImportC: duplicate symbol for declaration and


          Issue ID: 23025
           Summary: ImportC: duplicate symbol for declaration and
                    definition of variable
           Product: D
           Version: D2
          Hardware: All
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

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){
    return 0

duplicate symbol '_s' in:
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

Apr 16 2022