crt: Define atoll/strto[u]ll/strto[iu]max functions for all msvcrt builds
Functions _atoi64, _strtoi64 and _strtoui64 are available since the first
release of msvcrt.dll as part of MS Visual C++ 4.2.
Define functions atoll, strtoll, strtoull, strtoimax and strtoumax as
aliases for msvcrt _atoi64, _strtoi64 and _strtoui64 functions directly in
def files. This would allow applications to directly link to msvcrt
functions. Currently these functions are provided by mingw-w64 functions
strtoimax and strtoumax which are (statically) linked into executables.
Note that all these functions are provided since msvcr120.dll which is part
of MS Visual Studio 2013.
For compatibility with older msvcrt versions, functions _strtoi64 and
_strtoui64 are provided by mingw-w64 as aliases to mingw-w64 strtoimax and
strtoumax implementations.
Also implement atoll() and _atoi64() via strtoll() for older msvcrt
versions.
This change also removes static inline function atoll as now it is always
provided as alias at the link time for every msvcrt version.
Note that mingw-w64 functions strtoimax(), strtoumax() and atoll() should
not be packed into libmingwex.a because libmingwex.a takes precedence over
libmsvcr*.a. To ensure that version from libmsvcr*.a is used, it is
required to move mingw-w64 implementations from libmingwex.a to libmsvcr*.a
(for msvcrt versions which do not provide these functions).
Tested with following simple program and verified that compiled binary
calls _atoi64 and _strtoi64 symbols from msvcrt.dll:
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
int main(int argc, char *argv[]) {
printf("%lld\n", atoll(argv[1]));
printf("%lld\n", strtoll(argv[1], NULL, 0));
printf("%lld\n", strtoimax(argv[1], NULL, 0));
}
Signed-off-by: LIU Hao <lh_mouse@126.com>
18 files changed