Bug 22938 – ImportC: __import modules and their typedefs

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-26T05:52:17Z
Last change time
2024-12-13T19:21:46Z
Keywords
ImportC
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=22926
Moved to GitHub: dmd#18094 →

Comments

Comment #0 by bugzilla — 2022-03-26T05:52:17Z
The addition of a symbol table of typedefs to ImportC compilation raises a problem with imported files - the imported typedefs will be invisible during the parse. The solution is when an __import is seen, the current C compilation should be paused while the imported file is parsed. The typedef symbol table thus generated should then be made available to the importer. What to do about typedefs from imported D modules is a bit trickier. The workaround would be for the C importer to redeclare the typedef. Another possibility is to add a __cast keyword to distinguish cast expressions. (Or maybe support C++'s static_cast instead.)
Comment #1 by bugzilla — 2023-04-02T01:56:00Z
Example: // test.c(2): Error: found `1` when expecting `]` // test.c(2): Error: `=`, `;` or `,` expected to end declaration instead of `]` __import core.stdc.stdint; char cs[(int32_t)1];
Comment #2 by robert.schadek — 2024-12-13T19:21:46Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18094 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB