From 4851e60c7cd2c78d078b240694a691fcaa106bd3 Mon Sep 17 00:00:00 2001 From: Dev <9416650+aoinoikaz@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:09:32 -0500 Subject: [PATCH] lib: stub: readdir: Define readdir, not readir. lib/stub/readdir.c named its stub readir and returned an int, so a C library built with it, as libc is for mes_kernel=gnu and windows, had no readdir. Mes compiled by MesCC calls readdir for its readdir builtin (src/mescc-posix.c), and on Windows hex2 stopped linking mes with "Target label readdir is not valid". The stub now has 's signature and, as before, returns a null pointer with errno 0, the end of the directory. GNU Mes 0.27.1 has the misspelling. * lib/stub/readdir.c (readdir): Rename from readir. Take a DIR * and return a struct dirent *. Include for them rather than . --- lib/stub/readdir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/stub/readdir.c b/lib/stub/readdir.c index c00732af..bd135f29 100644 --- a/lib/stub/readdir.c +++ b/lib/stub/readdir.c @@ -19,11 +19,11 @@ */ #include +#include #include -#include -int -readir (DIR *dirstream) +struct dirent * +readdir (DIR *dir) { static int stub = 0; if (__mes_debug () && !stub)