From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: [PATCH 3/5] [mingw]: Do not export opendir, readdir etc., as dirents differ. Date: Tue, 15 Feb 2011 16:35:01 +0100 Message-ID: <1297784103-18322-4-git-send-email-janneke-list@xs4all.nl> References: <1297784103-18322-1-git-send-email-janneke-list@xs4all.nl> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1297784127 13995 80.91.229.12 (15 Feb 2011 15:35:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Feb 2011 15:35:27 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 15 16:35:23 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PpMvu-0007td-V2 for guile-devel@m.gmane.org; Tue, 15 Feb 2011 16:35:19 +0100 Original-Received: from localhost ([127.0.0.1]:49710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpMvu-0002IH-95 for guile-devel@m.gmane.org; Tue, 15 Feb 2011 10:35:18 -0500 Original-Received: from [140.186.70.92] (port=56893 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpMvo-0002Gc-5Z for guile-devel@gnu.org; Tue, 15 Feb 2011 10:35:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpMvm-0005sw-Rs for guile-devel@gnu.org; Tue, 15 Feb 2011 10:35:11 -0500 Original-Received: from smtp-vbr19.xs4all.nl ([194.109.24.39]:1276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpMvm-0005sE-Dz for guile-devel@gnu.org; Tue, 15 Feb 2011 10:35:10 -0500 Original-Received: from vuurvlieg.flower (peder.onsbrabantnet.nl [88.159.206.46] (may be forged)) (authenticated bits=0) by smtp-vbr19.xs4all.nl (8.13.8/8.13.8) with ESMTP id p1FFZ8QZ082257 for ; Tue, 15 Feb 2011 16:35:09 +0100 (CET) (envelope-from janneke-list@xs4all.nl) X-Mailer: git-send-email 1.7.1 In-Reply-To: <1297784103-18322-1-git-send-email-janneke-list@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-Received-From: 194.109.24.39 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11643 Archived-At: From: Jan Nieuwenhuizen 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 * 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 #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 -- Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.nl