Skip to content

Commit 18eef08

Browse files
author
Mike Pall
committed
Android/ARM: Fix build with recent NDK.
1 parent e1e3034 commit 18eef08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib_io.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ LJLIB_CF(io_method_flush) LJLIB_REC(io_flush 0)
304304
return luaL_fileresult(L, fflush(io_tofile(L)->fp) == 0, NULL);
305305
}
306306

307+
#if LJ_32 && defined(__ANDROID__) && __ANDROID_API__ < 24
308+
/* The Android NDK is such an unmatched marvel of engineering. */
309+
extern int fseeko32(FILE *, long int, int) __asm__("fseeko");
310+
extern long int ftello32(FILE *) __asm__("ftello");
311+
#define fseeko(fp, pos, whence) (fseeko32((fp), (pos), (whence)))
312+
#define ftello(fp) (ftello32((fp)))
313+
#endif
314+
307315
LJLIB_CF(io_method_seek)
308316
{
309317
FILE *fp = io_tofile(L)->fp;

0 commit comments

Comments
 (0)