Add initial snapshot of runtime crt.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@2 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/stdio/_Exit.c b/mingw-w64-crt/stdio/_Exit.c
new file mode 100755
index 0000000..58247f5
--- /dev/null
+++ b/mingw-w64-crt/stdio/_Exit.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+void _Exit(int status)
+ { _exit(status); }
diff --git a/mingw-w64-crt/stdio/atoll.c b/mingw-w64-crt/stdio/atoll.c
new file mode 100755
index 0000000..c7f45e5
--- /dev/null
+++ b/mingw-w64-crt/stdio/atoll.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+long long atoll (const char * _c)
+ { return _atoi64 (_c); }
diff --git a/mingw-w64-crt/stdio/fopen64.c b/mingw-w64-crt/stdio/fopen64.c
new file mode 100755
index 0000000..cba72ef
--- /dev/null
+++ b/mingw-w64-crt/stdio/fopen64.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+FILE* fopen64 (const char* filename, const char* mode)
+{
+ return fopen (filename, mode);
+}
diff --git a/mingw-w64-crt/stdio/fseeko64.c b/mingw-w64-crt/stdio/fseeko64.c
new file mode 100755
index 0000000..0dd288c
--- /dev/null
+++ b/mingw-w64-crt/stdio/fseeko64.c
@@ -0,0 +1,243 @@
+#include <stdio.h>
+#include <io.h>
+#include <errno.h>
+#include <windows.h>
+#include <internal.h>
+
+typedef union doubleint {
+ __int64 bigint;
+ struct {
+ unsigned long lowerhalf;
+ long upperhalf;
+ } twoints;
+} DINT;
+
+#define _IOYOURBUF 0x0100
+#define _IOSETVBUF 0x0400
+#define _IOFEOF 0x0800
+#define _IOFLRTN 0x1000
+#define _IOCTRLZ 0x2000
+#define _IOCOMMIT 0x4000
+
+/* General use macros */
+
+#define inuse(s) ((s)->_flag & (_IOREAD|_IOWRT|_IORW))
+#define mbuf(s) ((s)->_flag & _IOMYBUF)
+#define nbuf(s) ((s)->_flag & _IONBF)
+#define ybuf(s) ((s)->_flag & _IOYOURBUF)
+#define bigbuf(s) ((s)->_flag & (_IOMYBUF|_IOYOURBUF))
+#define anybuf(s) ((s)->_flag & (_IOMYBUF|_IONBF|_IOYOURBUF))
+
+#define _INTERNAL_BUFSIZ 4096
+#define _SMALL_BUFSIZ 512
+
+#define FOPEN 0x01 /* file handle open */
+#define FEOFLAG 0x02 /* end of file has been encountered */
+#define FCRLF 0x04 /* CR-LF across read buffer (in text mode) */
+#define FPIPE 0x08 /* file handle refers to a pipe */
+#define FNOINHERIT 0x10 /* file handle opened _O_NOINHERIT */
+#define FAPPEND 0x20 /* file handle opened O_APPEND */
+#define FDEV 0x40 /* file handle refers to device */
+#define FTEXT 0x80 /* file handle is in text mode */
+
+__int64 __cdecl _lseeki64(int fh,__int64 pos,int mthd);
+__int64 __cdecl _ftelli64(FILE *str);
+
+int fseeko64 (FILE* stream, _off64_t offset, int whence)
+{
+ return _fseeki64(stream,offset,whence);
+}
+
+int __cdecl _fseeki64(FILE *str,__int64 offset,int whence)
+{
+ FILE *stream;
+ /* Init stream pointer */
+ stream = str;
+ if(!stream || ((whence != SEEK_SET) && (whence != SEEK_CUR) && (whence != SEEK_END)))
+ {
+ errno=EINVAL;
+ return(-1);
+ }
+ /* Clear EOF flag */
+ stream->_flag &= ~_IOEOF;
+
+ if (whence == SEEK_CUR) {
+ offset += _ftelli64(stream);
+ whence = SEEK_SET;
+ }
+ /* Flush buffer as necessary */
+ fflush(stream);
+
+ /* If file opened for read/write, clear flags since we don't know
+ what the user is going to do next. If the file was opened for
+ read access only, decrease _bufsiz so that the next _filbuf
+ won't cost quite so much */
+
+ if (stream->_flag & _IORW)
+ stream->_flag &= ~(_IOWRT|_IOREAD);
+ else if ( (stream->_flag & _IOREAD) && (stream->_flag & _IOMYBUF) &&
+ !(stream->_flag & _IOSETVBUF) )
+ stream->_bufsiz = _SMALL_BUFSIZ;
+
+ /* Seek to the desired locale and return. */
+
+ return(_lseeki64(_fileno(stream), offset, whence) == -1ll ? -1 : 0);
+}
+
+__int64 __cdecl _lseeki64(int fh,__int64 pos,int mthd)
+{
+ DINT newpos; /* new file position */
+ unsigned long err; /* error code from API call */
+ HANDLE osHandle; /* o.s. handle value */
+
+
+ newpos.bigint = pos;
+ /* tell OS to seek */
+
+#if SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END
+#error Xenix and Win32 seek constants not compatible
+#endif
+ if ((osHandle = (HANDLE)_get_osfhandle(fh)) == (HANDLE)-1)
+ {
+ errno = EBADF;
+ _ASSERTE(("Invalid file descriptor. File possibly closed by a different thread",0));
+ return (-1ll);
+ }
+
+ if ( ((newpos.twoints.lowerhalf = SetFilePointer(osHandle,newpos.twoints.lowerhalf,&(newpos.twoints.upperhalf),mthd))==-1L) &&
+ ((err = GetLastError()) != NO_ERROR))
+ {
+ return( -1ll );
+ }
+
+ _osfile(fh) &= ~FEOFLAG; /* clear the ctrl-z flag on the file */
+ return( newpos.bigint ); /* return */
+}
+
+__int64 __cdecl _ftelli64(FILE *str)
+{
+ register FILE *stream;
+ size_t offset;
+ __int64 filepos;
+ register char *p;
+ char *max;
+ int fd;
+ size_t rdcnt;
+
+ stream = str;
+ fd = _fileno(stream);
+ if (stream->_cnt < 0) stream->_cnt = 0;
+ if ((filepos = _lseeki64(fd, 0ll, SEEK_CUR)) < 0L)
+ return(-1ll);
+
+ if (!bigbuf(stream)) /* _IONBF or no buffering designated */
+ return(filepos - stream->_cnt);
+
+ offset = (size_t)(stream->_ptr - stream->_base);
+
+ if (stream->_flag & (_IOWRT|_IOREAD)) {
+ if (_osfile(fd) & FTEXT)
+ for (p = stream->_base; p < stream->_ptr; p++)
+ if (*p == '\n') /* adjust for '\r' */
+ offset++;
+ }
+ else if (!(stream->_flag & _IORW)) {
+ errno=EINVAL;
+ return(-1ll);
+ }
+
+ if (filepos == 0ll)
+ return((__int64)offset);
+
+ if (stream->_flag & _IOREAD) /* go to preceding sector */
+
+ if (stream->_cnt == 0) /* filepos holds correct location */
+ offset = 0;
+
+ else {
+
+ /* Subtract out the number of unread bytes left in the
+ buffer. [We can't simply use _iob[]._bufsiz because
+ the last read may have hit EOF and, thus, the buffer
+ was not completely filled.] */
+
+ rdcnt = stream->_cnt + (size_t)(stream->_ptr - stream->_base);
+
+ /* If text mode, adjust for the cr/lf substitution. If
+ binary mode, we're outta here. */
+ if (_osfile(fd) & FTEXT) {
+ /* (1) If we're not at eof, simply copy _bufsiz
+ onto rdcnt to get the # of untranslated
+ chars read. (2) If we're at eof, we must
+ look through the buffer expanding the '\n'
+ chars one at a time. */
+
+ /* [NOTE: Performance issue -- it is faster to
+ do the two _lseek() calls than to blindly go
+ through and expand the '\n' chars regardless
+ of whether we're at eof or not.] */
+
+ if (_lseeki64(fd, 0ll, SEEK_END) == filepos) {
+
+ max = stream->_base + rdcnt;
+ for (p = stream->_base; p < max; p++)
+ if (*p == '\n')
+ /* adjust for '\r' */
+ rdcnt++;
+
+ /* If last byte was ^Z, the lowio read
+ didn't tell us about it. Check flag
+ and bump count, if necessary. */
+
+ if (stream->_flag & _IOCTRLZ)
+ ++rdcnt;
+ }
+
+ else {
+
+ if (_lseeki64(fd, filepos, SEEK_SET) < 0)
+ return (-1);
+
+ /* We want to set rdcnt to the number
+ of bytes originally read into the
+ stream buffer (before crlf->lf
+ translation). In most cases, this
+ will just be _bufsiz. However, the
+ buffer size may have been changed,
+ due to fseek optimization, at the
+ END of the last _filbuf call. */
+
+ if ( (rdcnt <= _SMALL_BUFSIZ) &&
+ (stream->_flag & _IOMYBUF) &&
+ !(stream->_flag & _IOSETVBUF) )
+ {
+ /* The translated contents of
+ the buffer is small and we
+ are not at eof. The buffer
+ size must have been set to
+ _SMALL_BUFSIZ during the
+ last _filbuf call. */
+
+ rdcnt = _SMALL_BUFSIZ;
+ }
+ else
+ rdcnt = stream->_bufsiz;
+
+
+ /* If first byte in untranslated buffer
+ was a '\n', assume it was preceeded
+ by a '\r' which was discarded by the
+ previous read operation and count
+ the '\n'. */
+ if (_osfile(fd) & FCRLF)
+ ++rdcnt;
+ }
+
+ } /* end if FTEXT */
+
+ filepos -= (__int64)rdcnt;
+
+ } /* end else stream->_cnt != 0 */
+
+ return(filepos + (__int64)offset);
+}
diff --git a/mingw-w64-crt/stdio/ftello64.c b/mingw-w64-crt/stdio/ftello64.c
new file mode 100755
index 0000000..0306576
--- /dev/null
+++ b/mingw-w64-crt/stdio/ftello64.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+_off64_t
+ftello64 (FILE * stream)
+{
+ return (_off64_t) _ftelli64(stream);
+}
diff --git a/mingw-w64-crt/stdio/lltoa.c b/mingw-w64-crt/stdio/lltoa.c
new file mode 100755
index 0000000..ddcd303
--- /dev/null
+++ b/mingw-w64-crt/stdio/lltoa.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+char* lltoa(long long _n, char * _c, int _i)
+ { return _i64toa (_n, _c, _i); }
diff --git a/mingw-w64-crt/stdio/lltow.c b/mingw-w64-crt/stdio/lltow.c
new file mode 100755
index 0000000..0c31c4a
--- /dev/null
+++ b/mingw-w64-crt/stdio/lltow.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+wchar_t* lltow(long long _n, wchar_t * _w, int _i)
+ { return _i64tow (_n, _w, _i); }
diff --git a/mingw-w64-crt/stdio/lseek64.c b/mingw-w64-crt/stdio/lseek64.c
new file mode 100755
index 0000000..5eab6d4
--- /dev/null
+++ b/mingw-w64-crt/stdio/lseek64.c
@@ -0,0 +1,7 @@
+#include <io.h>
+
+_off64_t lseek64(int fd,_off64_t offset, int whence)
+{
+ return _lseeki64(fd, (_off64_t) offset, whence);
+}
+
diff --git a/mingw-w64-crt/stdio/snprintf.c b/mingw-w64-crt/stdio/snprintf.c
new file mode 100755
index 0000000..7aacaad
--- /dev/null
+++ b/mingw-w64-crt/stdio/snprintf.c
@@ -0,0 +1,13 @@
+#include <stdarg.h>
+#include <stdio.h>
+
+int snprintf(char* buffer, size_t n, const char* format, ...)
+{
+ int retval;
+ va_list argptr;
+
+ va_start( argptr, format );
+ retval = _vsnprintf( buffer, n, format, argptr );
+ va_end( argptr );
+ return retval;
+}
diff --git a/mingw-w64-crt/stdio/snwprintf.c b/mingw-w64-crt/stdio/snwprintf.c
new file mode 100755
index 0000000..6a361b3
--- /dev/null
+++ b/mingw-w64-crt/stdio/snwprintf.c
@@ -0,0 +1,13 @@
+#include <stdarg.h>
+#include <wchar.h>
+
+int snwprintf(wchar_t* buffer, size_t n, const wchar_t* format, ...)
+{
+ int retval;
+ va_list argptr;
+
+ va_start( argptr, format );
+ retval = _vsnwprintf( buffer, n, format, argptr );
+ va_end( argptr );
+ return retval;
+}
diff --git a/mingw-w64-crt/stdio/strtof.c b/mingw-w64-crt/stdio/strtof.c
new file mode 100755
index 0000000..7ed8375
--- /dev/null
+++ b/mingw-w64-crt/stdio/strtof.c
@@ -0,0 +1,6 @@
+#include <stdlib.h>
+
+float strtof( const char *nptr, char **endptr)
+{
+ return (strtod(nptr, endptr));
+}
diff --git a/mingw-w64-crt/stdio/ulltoa.c b/mingw-w64-crt/stdio/ulltoa.c
new file mode 100755
index 0000000..f02a767
--- /dev/null
+++ b/mingw-w64-crt/stdio/ulltoa.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+char* ulltoa(unsigned long long _n, char * _c, int _i)
+ { return _ui64toa (_n, _c, _i); }
diff --git a/mingw-w64-crt/stdio/ulltow.c b/mingw-w64-crt/stdio/ulltow.c
new file mode 100755
index 0000000..50c7f49
--- /dev/null
+++ b/mingw-w64-crt/stdio/ulltow.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
+ { return _ui64tow (_n, _w, _i); }
diff --git a/mingw-w64-crt/stdio/vfscanf.c b/mingw-w64-crt/stdio/vfscanf.c
new file mode 100755
index 0000000..a2a2631
--- /dev/null
+++ b/mingw-w64-crt/stdio/vfscanf.c
@@ -0,0 +1,40 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt
+// Public domain: all copyrights disclaimed, absolutely no warranties */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+int vfscanf(FILE * __restrict__ stream, const char * __restrict__ format, va_list arg) {
+ int ret;
+
+ __asm__(
+
+ /* allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) */
+ "movq %%rsp, %%r10\n\t"
+ "lea 0xFFFFFFD8(%%rsp, %6), %%rsp\n\t"
+ "subq %5, %%rsp\n\t"
+
+ // set up stack
+ "movq %1, 0x18(%%rsp)\n\t" // stream
+ "movq %2, 0x20(%%rsp)\n\t" // format
+ "lea 0x28(%%rsp), %%rdi\n\t"
+ "movq %%rdi, (%%rsp)\n\t" // memcpy dest
+ "movq %5, 0x8(%%rsp)\n\t" // memcpy src
+ "movq %5, 0x10(%%rsp)\n\t"
+ "subq %6, 0x10(%%rsp)\n\t" // memcpy len
+ "call _memcpy\n\t"
+ "addq $24, %%rsp\n\t"
+
+ // call fscanf
+ "call _fscanf\n\t"
+
+ // restore stack
+ "movq %%r10, %%rsp\n\t"
+
+ : "=a"(ret), "=c"(stream), "=d"(format)
+ : "1"(stream), "2"(format), "S"(arg),
+ "a"(&ret)
+ : "r10", "rdi");
+
+ return ret;
+}
diff --git a/mingw-w64-crt/stdio/vfwscanf.c b/mingw-w64-crt/stdio/vfwscanf.c
new file mode 100755
index 0000000..a7033d7
--- /dev/null
+++ b/mingw-w64-crt/stdio/vfwscanf.c
@@ -0,0 +1,42 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt.
+// Public domain: all copyrights disclaimed, absolutely no warranties.
+
+#include <stdarg.h>
+#include <wchar.h>
+
+int vfwscanf(FILE * __restrict__ stream, const wchar_t * __restrict__ format,
+ va_list arg) {
+
+ int ret;
+
+ __asm__(
+
+ // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12))
+ "movq %%rsp, %%r10\n\t"
+ "lea 0xFFFFFFD8(%%rsp, %6), %%rsp\n\t"
+ "subq %5, %%rsp\n\t"
+
+ // set up stack
+ "movq %1, 0x18(%%rsp)\n\t" // stream
+ "movq %2, 0x20(%%rsp)\n\t" // format
+ "lea 0x28(%%rsp), %%edi\n\t"
+ "movq %%rdi, (%%rsp)\n\t" // memcpy dest
+ "movq %5, 0x8(%%rsp)\n\t" // memcpy src
+ "movq %5, 0x10(%%rsp)\n\t"
+ "subq %6, 0x10(%%rsp)\n\t" // memcpy len
+ "call _memcpy\n\t"
+ "addq $24, %%rsp\n\t"
+
+ // call fscanf
+ "call _fwscanf\n\t"
+
+ // restore stack
+ "movq %%r10, %%rsp\n\t"
+
+ : "=a"(ret), "=c"(stream), "=d"(format)
+ : "1"(stream), "2"(format), "S"(arg),
+ "a"(&ret)
+ : "r10", "rdi");
+
+ return ret;
+}
diff --git a/mingw-w64-crt/stdio/vscanf.c b/mingw-w64-crt/stdio/vscanf.c
new file mode 100755
index 0000000..e902931
--- /dev/null
+++ b/mingw-w64-crt/stdio/vscanf.c
@@ -0,0 +1,9 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt
+// Public domain: all copyrights disclaimed, absolutely no warranties
+
+#include <stdarg.h>
+#include <stdio.h>
+
+int vscanf(const char * __restrict__ format, va_list arg) {
+ return vfscanf(stdin, format, arg);
+}
diff --git a/mingw-w64-crt/stdio/vsnprintf.c b/mingw-w64-crt/stdio/vsnprintf.c
new file mode 100755
index 0000000..466e064
--- /dev/null
+++ b/mingw-w64-crt/stdio/vsnprintf.c
@@ -0,0 +1,5 @@
+#include <stdarg.h>
+#include <stdio.h>
+
+int vsnprintf (char* s, size_t n, const char* format, va_list arg)
+ { return _vsnprintf ( s, n, format, arg); }
diff --git a/mingw-w64-crt/stdio/vsnwprintf.c b/mingw-w64-crt/stdio/vsnwprintf.c
new file mode 100755
index 0000000..d24a35e
--- /dev/null
+++ b/mingw-w64-crt/stdio/vsnwprintf.c
@@ -0,0 +1,6 @@
+#include <_mingw.h>
+#include <stdarg.h>
+#include <wchar.h>
+
+int vsnwprintf(wchar_t *buffer, size_t n, const wchar_t * format, va_list argptr)
+ { return _vsnwprintf( buffer, n, format, argptr );}
diff --git a/mingw-w64-crt/stdio/vsscanf.c b/mingw-w64-crt/stdio/vsscanf.c
new file mode 100755
index 0000000..dbc45e5
--- /dev/null
+++ b/mingw-w64-crt/stdio/vsscanf.c
@@ -0,0 +1,41 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt.
+// Public domain: all copyrights disclaimed, absolutely no warranties.
+
+#include <stdarg.h>
+#include <stdio.h>
+
+
+int vsscanf(const char * __restrict__ s, const char * __restrict__ format, va_list arg) {
+ int ret;
+
+ __asm__(
+
+ // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12))
+ "movq %%rsp, %%r10\n\t"
+ "lea 0xFFFFFFD8(%%rsp, %6), %%rsp\n\t"
+ "subq %5, %%rsp\n\t"
+
+ // set up stack
+ "movq %1, 0x18(%%rsp)\n\t" // s
+ "movq %2, 0x20(%%rsp)\n\t" // format
+ "lea 0x14(%%esp), %%edi\n\t"
+ "movq %%rdi, (%%rsp)\n\t" // memcpy dest
+ "movq %5, 0x8(%%rsp)\n\t" // memcpy src
+ "movq %5, 0x10(%%rsp)\n\t"
+ "subq %6, 0x10(%%rsp)\n\t" // memcpy len
+ "call _memcpy\n\t"
+ "addq $24, %%rsp\n\t"
+
+ // call sscanf
+ "call _sscanf\n\t"
+
+ // restore stack
+ "movq %%r10, %%rsp\n\t"
+
+ : "=a"(ret), "=c"(s), "=d"(format)
+ : "1"(s), "2"(format), "S"(arg),
+ "a"(&ret)
+ : "r10", "rdi");
+
+ return ret;
+}
diff --git a/mingw-w64-crt/stdio/vswscanf.c b/mingw-w64-crt/stdio/vswscanf.c
new file mode 100755
index 0000000..7fab934
--- /dev/null
+++ b/mingw-w64-crt/stdio/vswscanf.c
@@ -0,0 +1,43 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt
+// Public domain: all copyrights disclaimed, absolutely no warranties */
+
+#include <stdarg.h>
+#include <wchar.h>
+
+
+int vswscanf(const wchar_t * __restrict__ s, const wchar_t * __restrict__ format,
+ va_list arg) {
+
+ int ret;
+
+ __asm__(
+
+ // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12))
+ "movq %%rsp, %%r10\n\t"
+ "lea 0xFFFFFFD8(%%rsp, %6), %%rsp\n\t"
+ "subq %5, %%rsp\n\t"
+
+ // set up stack
+ "movq %1, 0x18(%%rsp)\n\t" // s
+ "movq %2, 0x20(%%rsp)\n\t" // format
+ "lea 0x28(%%rsp), %%rdi\n\t"
+ "movq %%rdi, (%%rsp)\n\t" // memcpy dest
+ "movq %5, 0x8(%%rsp)\n\t" // memcpy src
+ "movq %5, 0x10(%%rsp)\n\t"
+ "subq %6, 0x10(%%rsp)\n\t" // memcpy len
+ "call _memcpy\n\t"
+ "addq $24, %%rsp\n\t"
+
+ // call sscanf
+ "call _swscanf\n\t"
+
+ // restore stack
+ "movq %%r10, %%rsp\n\t"
+
+ : "=a"(ret), "=c"(s), "=d"(format)
+ : "1"(s), "2"(format), "S"(arg),
+ "a"(&ret)
+ : "r10", "rdi");
+
+ return ret;
+}
diff --git a/mingw-w64-crt/stdio/vwscanf.c b/mingw-w64-crt/stdio/vwscanf.c
new file mode 100755
index 0000000..c507a28
--- /dev/null
+++ b/mingw-w64-crt/stdio/vwscanf.c
@@ -0,0 +1,10 @@
+// By aaronwl 2003-01-28 for mingw-msvcrt.
+// Public domain: all copyrights disclaimed, absolutely no warranties.
+
+#include <stdarg.h>
+#include <wchar.h>
+#include <stdio.h>
+
+int vwscanf(const wchar_t * __restrict__ format, va_list arg) {
+ return vfwscanf(stdin, format, arg);
+}
diff --git a/mingw-w64-crt/stdio/wcstof.c b/mingw-w64-crt/stdio/wcstof.c
new file mode 100755
index 0000000..3068435
--- /dev/null
+++ b/mingw-w64-crt/stdio/wcstof.c
@@ -0,0 +1,6 @@
+#include <wchar.h>
+
+float wcstof( const wchar_t *nptr, wchar_t **endptr)
+{
+ return (wcstod(nptr, endptr));
+}
diff --git a/mingw-w64-crt/stdio/wtoll.c b/mingw-w64-crt/stdio/wtoll.c
new file mode 100755
index 0000000..f8d3db4
--- /dev/null
+++ b/mingw-w64-crt/stdio/wtoll.c
@@ -0,0 +1,3 @@
+#include <stdlib.h>
+long long wtoll(const wchar_t * _w)
+ { return _wtoi64 (_w); }