guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/5] [mingw]: Do not export opendir, readdir etc., as dirents dif


From: Jan Nieuwenhuizen
Subject: [PATCH 3/5] [mingw]: Do not export opendir, readdir etc., as dirents differ.
Date: Tue, 15 Feb 2011 16:35:01 +0100

From: Jan Nieuwenhuizen <address@hidden>

Without this patch, libguile exports symbols such as opendir, readdir,
which expect and use guile's struct dirent that differs from mingw's
dirent.  Linking to libguile when using mingw's dirent gives unexpected
results.

2011-02-15  Jan Nieuwenhuizen  <address@hidden>

        * libguile/win32-dirent.c:
        * libguile/filesys.c [MINGW32]: Include win32-dirent.h early,
        to pick-up defines.

        * libguile/win32-dirent.h (opendir, readdir, closedir, rewinddir,
        seekdir, telldir, dirfd): #define to guile_opendir ect.
---
 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 93b0ce2..880ee86 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -35,6 +35,10 @@
 #include <stdio.h>
 #include <errno.h>
 
+#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 <config.h>
 #endif
 
+#include "win32-dirent.h"
+
 #include "libguile/__scm.h"
 
 #include <windows.h>
 #include <stdio.h>
 #include <string.h>
 
-#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 <sys/types.h>
 
+#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

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]