July 09, 2023 [Issue 24042] New: ImportC: Error: no definition for static 'function' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24042 Issue ID: 24042 Summary: ImportC: Error: no definition for static 'function' Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ibuclaw@gdcproject.org ``` // cfile.c static int staticfunc() { return 0; } // dmodule.d import cfile; int main() { return staticfunc(); } ``` Compiler IMO correctly issues an error --- Error: no definition for static staticfunc --- However, besides the obvious lack of source file/line information, it looks like the error occurs (in the back-end) because the symbol is missing from compilation, rather than just disallowing the referencing of C static symbols from D. Even if both D and C sources are compiled in the same CU, I find it questionable to allow referencing C static symbols from D. But that can be debated out here. For reference, this is where in dmd backend the error comes from. ``` // In backend/cgen.d if (f.sym.Sseg == UNKNOWN) { printf("Error: no definition for static %s\n", prettyident(f.sym)); // no definition found for static err_exit(); // BUG: do better } ``` -- |
Copyright © 1999-2021 by the D Language Foundation