Function _lseeki64() is available since msvcrt40.dll. For older CRT
libraries provides emulation via lseek().
---
 mingw-w64-crt/Makefile.am       |  1 +
 mingw-w64-crt/stdio/_lseeki64.c | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 mingw-w64-crt/stdio/_lseeki64.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index ae731685d317..4202d535e2a3 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -820,6 +820,7 @@ src_pre_msvcrt40=\
   misc/dummy__setusermatherr.c \
   stdio/_filelengthi64.c \
   stdio/_fstat32i64.c \
+  stdio/_lseeki64.c \
   stdio/_stat32i64.c \
   stdio/_wstat32i64.c \
   stdio/fgetpos.c \
diff --git a/mingw-w64-crt/stdio/_lseeki64.c b/mingw-w64-crt/stdio/_lseeki64.c
new file mode 100644
index 000000000000..ce8152e174b6
--- /dev/null
+++ b/mingw-w64-crt/stdio/_lseeki64.c
@@ -0,0 +1,22 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#include <io.h>
+#include <errno.h>
+#include <limits.h>
+
+/* Define 64-bit _lseeki64() function via 32-bit _lseek() function */
+__int64 __cdecl _lseeki64(int fd, __int64 offset, int whence)
+{
+  if (offset > LONG_MAX)
+  {
+    errno = EOVERFLOW;
+    return -1;
+  }
+
+  return _lseek(fd, offset, whence);
+}
+__int64 (__cdecl *__MINGW_IMP_SYMBOL(_lseeki64))(int, __int64, int) = 
_lseeki64;
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to