digitalmars.D.bugs - [Issue 23011] New: importC: asm label to set symbol name doesn't
- d-bugmail puremagic.com (33/33) Apr 13 2022 https://issues.dlang.org/show_bug.cgi?id=23011
https://issues.dlang.org/show_bug.cgi?id=23011 Issue ID: 23011 Summary: importC: asm label to set symbol name doesn't work with externs Product: D Version: D2 Hardware: All OS: Linux Status: NEW Keywords: ImportC Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: duser neet.fi CC: duser neet.fi runnable example (that currently fails): extern char **myenviron asm("environ"); int myprintf(char *, ...) asm("printf"); int main() { void *p = &myenviron; myprintf("%p\n", p); return 0; } works with gcc/clang, gives a link error with dmd /usr/bin/ld: test.o: in function `main': test.c:(.text.main[main]+0x7): undefined reference to `myenviron' /usr/bin/ld: test.c:(.text.main[main]+0x18): undefined reference to `myprintf' collect2: error: ld returned 1 exit status Error: linker exited with status 1 it should be linking with the names given in asm() --
Apr 13 2022