Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit b2c58c7

Browse files
committedOct 26, 2018
rt/msvc.c: Use MSVCRT's _fileno for weak symbol fileno
`_fileno` exists in the pre-2015 DLLs according to MinGW-w64. This is required as preparation for the MinGW-w64 libs (dlang/installer#346), as they define the weak symbol like this, and LLD complains about mismatches (while MS' link.exe doesn't).
1 parent 01e8714 commit b2c58c7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎src/rt/msvc.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,18 @@ void init_msvc()
7575

7676
// VS2015+ provides C99-conformant (v)snprintf functions, so weakly
7777
// link to legacy _(v)snprintf (not C99-conformant!) for VS2013- only
78-
7978
DECLARE_ALTERNATE_NAME (snprintf, _snprintf);
8079
DECLARE_ALTERNATE_NAME (vsnprintf, _vsnprintf);
8180

82-
// VS2013- implements these functions as macros, VS2015+ provides symbols
81+
DECLARE_ALTERNATE_NAME (fileno, _fileno);
8382

83+
// VS2013- implements these functions as macros, VS2015+ provides symbols
8484
DECLARE_ALTERNATE_NAME (_fputc_nolock, _msvc_fputc_nolock);
8585
DECLARE_ALTERNATE_NAME (_fgetc_nolock, _msvc_fgetc_nolock);
8686
DECLARE_ALTERNATE_NAME (rewind, _msvc_rewind);
8787
DECLARE_ALTERNATE_NAME (clearerr, _msvc_clearerr);
8888
DECLARE_ALTERNATE_NAME (feof, _msvc_feof);
8989
DECLARE_ALTERNATE_NAME (ferror, _msvc_ferror);
90-
DECLARE_ALTERNATE_NAME (fileno, _msvc_fileno);
9190

9291
// VS2013- helper functions
9392
int _filbuf(FILE* fp);
@@ -152,11 +151,6 @@ int _msvc_ferror(FILE* stream)
152151
return stream->_flag & _IOERR;
153152
}
154153

155-
int _msvc_fileno(FILE* stream)
156-
{
157-
return stream->_file;
158-
}
159-
160154

161155

162156
/**

0 commit comments

Comments
 (0)
This repository has been archived.