Every executable references only one of those symbols. So if symbols are
split into separate files, linker includes only the one which is used.
(While splitting, simplify the use of headers as well.)
crtdll.dll and msvcrt10.dll do not have entry point for wide wmain() and
therefore they do not need __winitenv init symbol. So do not provide
__winitenv symbol for these two CRT import libraries.
Signed-off-by: Martin Storsjö <martin@martin.st>
File mingw-w64-crt/misc/initenv.c provides same implementation of __initenv
and __winitenv symbols as file mingw-w64-crt/misc/__initenv.c.
So remove duplicate file.
Signed-off-by: Martin Storsjö <martin@martin.st>
Global variable __badioinfo is exported from VC42+ CRT import libraries.
It is not exported from UCRT.
So it is not available in UCRT, msvcrt40.dll and older CRT versions.
Symbol is just a global ioinfo structure with bad (-1) file descriptor.
Provide this structure also in import libraries for older CRT versions and
UCRT, so the symbols will be in all CRT import libraries.
Signed-off-by: Martin Storsjö <martin@martin.st>
Symbol __badioinfo represents a variable of structure type. Not a pointer
to structure and neither not a pointer to array of structures.
Signed-off-by: Martin Storsjö <martin@martin.st>
Expand _t*ll* and _t*[ui]max* macros to *ll* and *[ui]max** functions
(instead of *i64* functions). This is just for consistency and should not
change any behavior.
mingw-w64 for all CRT import libraries (which provide *i64* functions)
already provides also *ll* and *[ui]max* functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
Use same conditions for providing _wtoll and _wtoll_l symbols aliases as
are already used for atoll and _atoll_l symbol aliases.
Signed-off-by: Martin Storsjö <martin@martin.st>
Functions _wcstoi64() and _wcstoui64() are available since msvcr70.dll and
are equivalent to C99 wcstoll() and wcstoull() functions. As mingw-w64
defines intmax_t and uintmax_t types 64-bit, same as (unsigned) long long,
these functions are equivalent also to C99 wcstoimax() and wcstoumax()
functions.
So for msvcr70+ import libraries define C99 function symbols wcstoll,
wcstoull, wcstoimax and wcstoumax as aliases to _wcstoi64 and _wcstoui64
symbols in the same way as are defined aliases to _strtoi64 and _strtoui64
symbols.
For previous versions use mingw-w64 implementation from wcstoimax.c and
wcstoumax.c files. Move them from libmingwex library to individual CRT
import libraries, to ensure that for msvcr70+ is used the native version
(and not the one from libmingwex).
This change mimics commits c52f1eb099 and
4953f7746a but for wide-char functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
C99 isblank symbol is natively available since msvcr120.dll, so include
mingw-w64 implementation of isblank to CRT import libraries only up to the
msvcr110 version.
This allows to use native isblank symbol for UCRT and msvcr120 builds.
Import libraries msvcr100 and msvcr110 currently do not have version
specific extra library, so define it and include it in MRI scripts.
Signed-off-by: Martin Storsjö <martin@martin.st>
ARM32 and ARM64 always contain all Vista symbols. So use them directly
instead of the mingw-w64 emulation.
The only Vista+ symbol which stay disabled in the def file is vsnprintf.
It is because this Vista+ vsnprintf symbol is not C99 compatible and is
just an alias to _vsnprintf symbol which does not fill nul term byte.
Signed-off-by: Martin Storsjö <martin@martin.st>
Include all ARM64 C++ mangled symbols. Add _local_unwind symbol which is
present also in ARM64 version. And remove _setjmp, setjmp and __jump_unwind
symbols which are not present in any ARM64 version.
As a reference were checked msvcrt.dll versions 7.0.17083.1000 and
7.0.19041.546 and all have same set of symbols.
Signed-off-by: Martin Storsjö <martin@martin.st>
Usage of F_I386() macro per symbol allows to easily identify via "git grep"
if the particular symbol is available for specific architecture or not.
"#ifdef DEF_I386" prevents easy usage of "git grep".
So change remaining "#ifdef DEF_I386" blocks by per-symbol F_I386() macros.
Signed-off-by: Martin Storsjö <martin@martin.st>
Functions _fseeki64() and _ftelli64() are natively available since
msvcr80.dll.
mingw-w64 already provides emulation of _fseeki64() and _ftelli64()
functions for msvcrt.dll import library via _filelengthi64(), fgetpos(),
fsetpos() and fflush() functions.
So include this emulation into all pre-msvcr80 CRT import libraries as all
of import libraries for them already contains all ABI-compatible dependent
functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
Function _filelengthi64() is available since msvcrt40.dll.
For previous CRT versions, which have only 32-bit file offsets, define it
as wrapper around 32-bit _filelength() function.
Signed-off-by: Martin Storsjö <martin@martin.st>
Functions fgetpos64() and fsetpos64() are just aliases for functions
fgetpos() and fsetpos() as they are already using 64-bit fpos_t type.
Most aliased functions are defined in crt-aliases.def.in file. Do same also
for fgetpos64() and fsetpos64() functions by moving them from individual C
files stdio/fgetpos64.c and stdio/fsetpos64.c.
Libraries which do not have real fgetpos() and fsetpos() have aliases
defined in the same file were are defined compatibility wrappers.
Signed-off-by: Martin Storsjö <martin@martin.st>
Functions fgetpos() and fsetpos() in these libraries have different ABI
than in all later versions starting with msvcrt40.
Their second argument is pointer to 32-bit signed value, which is not
compatible with the fpos_t type (64-bit), used by all later versions.
So rename these functions in these import libraries to names with suffix 32
and provides mingw-w64 fpos_t (64-bit) wrappers around them for ABI
compatibility.
This change fixes ABI compatibility for those older DLL libraries.
Signed-off-by: Martin Storsjö <martin@martin.st>
Functions _get_errno() and _set_errno() are natively available since
msvcr80.dll and also since Windows Vista version of msvcrt.dll.
Import libraries for crtdll, msvcrt10-40 and msvcrt.dll already contains
emulation of these functions. Include this emulation also for msvcr70 and
msvcr71, so these functions would be available in all CRT import libraries.
Signed-off-by: Martin Storsjö <martin@martin.st>
Function _wassert() is natively available since msvcr80.dll and also since
Windows Vista version of msvcrt.dll.
Import library for i386 version of msvcrt.dll already contains emulation of
this function.
Include this emulation into x64 version of msvcrt.dll and also into crtdll,
msvcrt10-40 and msvcr70-71 libraries, so function _wassert() would be
available in all CRT import libraries.
For import libraries other than msvcrt.dll, improve emulation code, so it
does not try to resolve that function from DLL as in other versions it is
never available.
Signed-off-by: Martin Storsjö <martin@martin.st>
Function _set_purecall_handler() is natively available since msvcr70.dll.
For all previous CRT versions include mingw-w64 emulation.
Emulation is already included for msvcrt-os.
Signed-off-by: Martin Storsjö <martin@martin.st>
These functions are natively available since msvcr80.dll and also since
Vista version of msvcrt.dll. They are available also in ARM versions.
For all older CRT versions include mingw-w64 emulation.
Emulation in misc/output_format.c is slightly updated to optimize code for
non-msvcrt.dll version which do not provide these functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
Function _configthreadlocale() is natively available since msvcr80.dll.
For all previous CRT versions include mingw-w64 emulation.
Emulation is already included for msvcrt-os.
Signed-off-by: Martin Storsjö <martin@martin.st>