Skip to content

Commit b50d36b

Browse files
authored
Merge pull request #264 from BBasile/fix-win-2072
fix #263, Impossible to build under Windows with phobos 2.072
2 parents 7961bfc + 593b988 commit b50d36b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/dfmt/main.d

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ else
113113
// On Windows, set stdout to binary mode (needed for correct EOL writing)
114114
// See Phobos' stdio.File.rawWrite
115115
{
116-
import std.stdio : _fileno, _O_BINARY, _setmode;
117-
118-
immutable fd = _fileno(output.getFP());
116+
import std.stdio : _O_BINARY;
117+
immutable fd = output.fileno;
119118
_setmode(fd, _O_BINARY);
120119
version (CRuntime_DigitalMars)
121120
{
@@ -212,6 +211,19 @@ else
212211
}
213212
}
214213

214+
private version (Windows)
215+
{
216+
version(CRuntime_DigitalMars)
217+
{
218+
extern(C) int setmode(int, int) nothrow @nogc;
219+
alias _setmode = setmode;
220+
}
221+
else version(CRuntime_Microsoft)
222+
{
223+
extern(C) int _setmode(int, int) nothrow @nogc;
224+
}
225+
}
226+
215227
private string optionsToString(E)() if (is(E == enum))
216228
{
217229
import std.traits : EnumMembers;

0 commit comments

Comments
 (0)