From 208da616f6b43e3edce869aecb8e7f03e1378cd0 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 31 Jan 2011 21:43:20 +0100 Subject: [PATCH] For mingw, rename exported readdir et al. to guile_readdir, guile_*. This fixes running LilyPond, which links to glib and guile. Glib also exports "readdir" and it also installs the corresponding dirent.h, with different definitions. Eg, glib's struct dirent struct dirent { long d_ino; /* Always zero. */ unsigned short d_reclen; /* Always zero. */ unsigned short d_namlen; /* Length of name in d_name. */ char d_name[FILENAME_MAX]; /* File name. */ }; does not include off_t d_off. --- libguile/filesys.c | 5 ++++- libguile/win32-dirent.c | 4 ++-- libguile/win32-dirent.h | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libguile/filesys.c b/libguile/filesys.c index d6251a0..0a318f0 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -35,6 +35,10 @@ #include #include +#if defined (__MINGW32__) || defined (_MSC_VER) || defined (__BORLANDC__) +# include "win32-dirent.h" +#endif /* __MINGW32__ || _MSC_VER || __BORLANDC__ */ + #include "libguile/_scm.h" #include "libguile/smob.h" #include "libguile/feature.h" @@ -94,7 +98,6 @@ #if defined (__MINGW32__) || defined (_MSC_VER) || defined (__BORLANDC__) -# include "win32-dirent.h" # define NAMLEN(dirent) strlen((dirent)->d_name) /* The following bits are per AC_HEADER_DIRENT doco in the autoconf manual */ #elif HAVE_DIRENT_H diff --git a/libguile/win32-dirent.c b/libguile/win32-dirent.c index de170c7..b5b2c60 100644 --- a/libguile/win32-dirent.c +++ b/libguile/win32-dirent.c @@ -20,14 +20,14 @@ # include #endif +#include "win32-dirent.h" + #include "libguile/__scm.h" #include #include #include -#include "win32-dirent.h" - DIR * opendir (const char * name) { diff --git a/libguile/win32-dirent.h b/libguile/win32-dirent.h index 578db49..f9f8fe9 100644 --- a/libguile/win32-dirent.h +++ b/libguile/win32-dirent.h @@ -27,6 +27,14 @@ #include +#define opendir guile_opendir +#define readdir guile_readdir +#define closedir guile_closedir +#define rewinddir guile_rewinddir +#define seekdir guile_seekdir +#define telldir guile_telldir +#define dirfd guile_dirfd + struct dirstream { int fd; /* File descriptor. */ -- 1.7.1