-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
Description
When I use ldc2 to build a C library, I get these kinds of errors if my d file uses std.stdio
dmd works fine without any issues!
> d++ --compiler=ldc2 file.dpp file.lib entry.d
C:\tools\ldc2-1.24.0-windows-x64\bin\..\import\core\stdc\stdio.d(1317): Error: Function type does not match previously declared function with the same mangled name: `fwrite`
C:\tools\ldc2-1.24.0-windows-x64\bin\..\import\core\stdc\stdio.d(1317): Previous IR type: i64 (i8*, i64, i64, %file._iobuf*)
C:\tools\ldc2-1.24.0-windows-x64\bin\..\import\core\stdc\stdio.d(1317): New IR type: i64 (i8*, i64, i64, %core.stdc.stdio._iobuf*)
This is because I have writeln("hello"); in the main function of entry.d which imports file.
I noticed that dpp generates these conflicting definitions.
alias FILE = _iobuf;
struct _iobuf
{
void* _Placeholder;
}
ulong fwrite(const(void)*, ulong, ulong, _iobuf*) @nogc nothrow;
The issue is the same on Ubuntu or Windows.
Reactions are currently unavailable