From: Ryan Johnson <ryan.johnson@cs.utoronto.ca>
To: cygwin-developers@cygwin.com
Subject: Broken header dirent.h
Date: Sat, 12 Jul 2014 17:54:00 -0000 [thread overview]
Message-ID: <53C17623.60807@cs.utoronto.ca> (raw)
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
Hi all,
Please CC me in replies, I'm no longer a list member.
I recently tried to use <sys/dirent.h> in a C++ program and got linker
errors. Turns out the header is neither C++-aware (extern "C") nor
cygwin-aware (_EXFUN).
The attached patch fixes the problem for me.
Regards,
Ryan
[-- Attachment #2: dirent.h.patch --]
[-- Type: text/plain, Size: 2154 bytes --]
--- dirent.h.orig 2014-05-23 04:36:40.000000000 -0400
+++ dirent.h 2014-07-12 12:31:44.904628400 -0400
@@ -15,6 +15,10 @@
#include <sys/types.h>
#include <limits.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define __DIRENT_VERSION 2
#ifndef __x86_64__
@@ -62,32 +66,32 @@
#pragma pack(pop)
#endif
-DIR *opendir (const char *);
-DIR *fdopendir (int);
-struct dirent *readdir (DIR *);
-int readdir_r (DIR * __restrict, struct dirent * __restrict,
- struct dirent ** __restrict);
-void rewinddir (DIR *);
-int closedir (DIR *);
+DIR *_EXFUN(opendir, (const char *));
+DIR *_EXFUN(fdopendir, (int));
+struct dirent *_EXFUN(readdir, (DIR *));
+int _EXFUN(readdir_r, (DIR * __restrict, struct dirent * __restrict,
+ struct dirent ** __restrict));
+void _EXFUN(rewinddir, (DIR *));
+int _EXFUN(closedir, (DIR *));
-int dirfd (DIR *);
+int _EXFUN(dirfd, (DIR *));
#ifndef _POSIX_SOURCE
#ifndef __INSIDE_CYGWIN__
-long telldir (DIR *);
-void seekdir (DIR *, long loc);
+long _EXFUN(telldir, (DIR *));
+void _EXFUN(seekdir, (DIR *, long loc));
#endif
-int scandir (const char *__dir,
+int _EXFUN(scandir, (const char *__dir,
struct dirent ***__namelist,
int (*select) (const struct dirent *),
- int (*compar) (const struct dirent **, const struct dirent **));
+ int (*compar) (const struct dirent **, const struct dirent **)));
-int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
+int _EXFUN(scandirat, (int __dirfd, const char *__dir, struct dirent ***__namelist,
int (*select) (const struct dirent *),
- int (*compar) (const struct dirent **, const struct dirent **));
+ int (*compar) (const struct dirent **, const struct dirent **)));
-int alphasort (const struct dirent **__a, const struct dirent **__b);
+int _EXFUN(alphasort, (const struct dirent **__a, const struct dirent **__b));
#ifdef _DIRENT_HAVE_D_TYPE
/* File types for `d_type'. */
enum
@@ -117,4 +121,8 @@
# define DTTOIF(dirtype) ((dirtype) << 12)
#endif /* _DIRENT_HAVE_D_TYPE */
#endif /* _POSIX_SOURCE */
+
+#ifdef __cplusplus
+}
+#endif
#endif /*_SYS_DIRENT_H*/
next reply other threads:[~2014-07-12 17:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-12 17:54 Ryan Johnson [this message]
2014-07-14 8:49 ` Corinna Vinschen
2014-07-14 14:51 ` Ryan Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C17623.60807@cs.utoronto.ca \
--to=ryan.johnson@cs.utoronto.ca \
--cc=cygwin-developers@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).