[Issue 22974] New: importC: D name mangling applied to extern variable inside function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 2 21:00:09 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22974
Issue ID: 22974
Summary: importC: D name mangling applied to extern variable
inside function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: duser at neet.fi
CC: duser at neet.fi
// a.c
int x;
// b.c
int main()
{
extern int x;
x = 1;
return 0;
}
compile: dmd a.c b.c
/usr/bin/ld: a.o: in function `main':
b.c:(.text.main[main]+0x3): undefined reference to `_D1b4mainUY1xi'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
--
More information about the Digitalmars-d-bugs
mailing list