[Issue 24129] ImportC: cannot compile any non-trivial program with multiple translation units/files: fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '__acrt_locale_get_ctype_array_value'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 6 07:33:43 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24129
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla at digitalmars.com
--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
The problem stems from when a.c and b.c are compiled together, as in:
dmd a.c b.c
The code from both gets placed in one object file, a.obj. Hence there are two
copies of __acrt_local_get_ctype_array value, and they conflict with each
other.
The workaround is to compile them separately.
The same result is exhibited with this simple test case:
--- a.c ---
inline int test() { return 73; }
void *def() { return &test; }
int main() { return 0; }
----- b.c -------
inline int test() { return 73; }
void *def() { return &test; }
---------------
dmd a.c b.c
a.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT 'test'
Error: linker exited with status 1179
--
More information about the Digitalmars-d-bugs
mailing list