Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2003-02-11 00:13:34 +0300
committerDanny Smith <dannysmith@users.sourceforge.net>2003-02-11 00:13:34 +0300
commit14e54d7c97e4b202bbd7eef189afa384887551c3 (patch)
treeffc6a63bbaeaaf3e1ec1a2a822af652880a1b91a
parent16f4e17208de78a7dd75038073c4bc1a2c254ce4 (diff)
* include/_mingw.h (_CRTIMP): Define for __GNUC__ if
__declspec(dllimport) supported. (__cdecl): Define if not already defined. (__stdcall): Likewise. * include/dirent.h: Qualify fuctions with __cdecl. * include/fenv.h: Likewise. * include/inttypes.h: Likewise. * include/assert.h: Qualify fuctions with __cdecl. Qualify CRT dll imports with _CRTIMP. * include/conio.h: Likewise. * include/ctype.h: Likewise. * include/direct.h: Likewise. * include/dos.h: Likewise. * include/errno.h: Likewise. * include/float.h: Likewise. * include/io.h: Likewise. * include/locale.h: Likewise. * include/malloc.h: Likewise. * include/math.h: Likewise. * include/mbctype.h: Likewise. * include/mbstring.h: Likewise. * include/process.h: Likewise. * include/setjmp.h: Likewise. * include/signal.h: Likewise. * include/stdio.h: Likewise. * include/stdlib.h: Likewise. * include/string.h: Likewise. * include/time.h: Likewise. * include/wchar.h: Likewise. * include/wctype.h: Likewise. * include/sys/stat.h: Likewise. * include/sys/timeb.h: Likewise. * include/sys/utime.h: Likewise. * include/ctype.h: Guard ctype inlines with __NO_INLINE__. * include/wctype.h: Guard wctype inlines with __NO_INLINE__. * include/stdio.h (__VALIST): Guard against prior definition.
-rw-r--r--winsup/mingw/ChangeLog41
-rw-r--r--winsup/mingw/include/_mingw.h23
-rw-r--r--winsup/mingw/include/assert.h2
-rw-r--r--winsup/mingw/include/conio.h29
-rw-r--r--winsup/mingw/include/ctype.h157
-rw-r--r--winsup/mingw/include/direct.h20
-rw-r--r--winsup/mingw/include/dirent.h24
-rw-r--r--winsup/mingw/include/dos.h2
-rw-r--r--winsup/mingw/include/errno.h2
-rw-r--r--winsup/mingw/include/fenv.h22
-rw-r--r--winsup/mingw/include/float.h30
-rw-r--r--winsup/mingw/include/inttypes.h18
-rw-r--r--winsup/mingw/include/io.h148
-rw-r--r--winsup/mingw/include/locale.h6
-rw-r--r--winsup/mingw/include/malloc.h18
-rw-r--r--winsup/mingw/include/math.h406
-rw-r--r--winsup/mingw/include/mbctype.h30
-rw-r--r--winsup/mingw/include/mbstring.h146
-rw-r--r--winsup/mingw/include/process.h92
-rw-r--r--winsup/mingw/include/setjmp.h4
-rw-r--r--winsup/mingw/include/signal.h4
-rw-r--r--winsup/mingw/include/stdio.h218
-rw-r--r--winsup/mingw/include/stdlib.h233
-rw-r--r--winsup/mingw/include/string.h182
-rw-r--r--winsup/mingw/include/sys/stat.h20
-rw-r--r--winsup/mingw/include/sys/timeb.h4
-rw-r--r--winsup/mingw/include/sys/utime.h8
-rw-r--r--winsup/mingw/include/time.h44
-rw-r--r--winsup/mingw/include/wchar.h183
-rw-r--r--winsup/mingw/include/wctype.h73
30 files changed, 1128 insertions, 1061 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index b0666e73d..3c767fb89 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,44 @@
+2003-02-10 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * include/_mingw.h (_CRTIMP): Define for __GNUC__ if
+ __declspec(dllimport) supported.
+ (__cdecl): Define if not already defined.
+ (__stdcall): Likewise.
+ * include/dirent.h: Qualify fuctions with __cdecl.
+ * include/fenv.h: Likewise.
+ * include/inttypes.h: Likewise.
+ * include/assert.h: Qualify fuctions with __cdecl. Qualify
+ CRT dll imports with _CRTIMP.
+ * include/conio.h: Likewise.
+ * include/ctype.h: Likewise.
+ * include/direct.h: Likewise.
+ * include/dos.h: Likewise.
+ * include/errno.h: Likewise.
+ * include/float.h: Likewise.
+ * include/io.h: Likewise.
+ * include/locale.h: Likewise.
+ * include/malloc.h: Likewise.
+ * include/math.h: Likewise.
+ * include/mbctype.h: Likewise.
+ * include/mbstring.h: Likewise.
+ * include/process.h: Likewise.
+ * include/setjmp.h: Likewise.
+ * include/signal.h: Likewise.
+ * include/stdio.h: Likewise.
+ * include/stdlib.h: Likewise.
+ * include/string.h: Likewise.
+ * include/time.h: Likewise.
+ * include/wchar.h: Likewise.
+ * include/wctype.h: Likewise.
+ * include/sys/stat.h: Likewise.
+ * include/sys/timeb.h: Likewise.
+ * include/sys/utime.h: Likewise.
+
+ * include/ctype.h: Guard ctype inlines with __NO_INLINE__.
+ * include/wctype.h: Guard wctype inlines with __NO_INLINE__.
+
+ * include/stdio.h (__VALIST): Guard against prior definition.
+
2003-02-08 Earnie Boyd <earnie@users.sf.net>
* include/_mingw.h: Change version to 3.0
diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h
index b1eec3598..439b5beaf 100644
--- a/winsup/mingw/include/_mingw.h
+++ b/winsup/mingw/include/_mingw.h
@@ -29,6 +29,7 @@
__DECLSPEC_SUPPORTED Defined if dllimport attribute is supported.
__MINGW_IMPORT The attribute definition to specify imported
variables/functions.
+ _CRTIMP As above. For MS compatibility.
__MINGW32_VERSION Runtime version.
__MINGW32_MAJOR_VERSION Runtime major version.
__MINGW32_MINOR_VERSION Runtime minor version.
@@ -47,6 +48,9 @@
# ifndef __MINGW_IMPORT
# define __MINGW_IMPORT __declspec(dllimport)
# endif
+# ifndef _CRTIMP
+# define _CRTIMP __declspec(dllimport)
+# endif
# define __DECLSPEC_SUPPORTED
#else /* __GNUC__ */
# ifdef __declspec
@@ -55,12 +59,24 @@
/* Note the extern. This is needed to work around GCC's
limitations in handling dllimport attribute. */
# define __MINGW_IMPORT extern __attribute__((dllimport))
-# endif
+# endif
+# ifndef _CRTIMP
+# define _CRTIMP __attribute__((dllimport))
+# endif
# define __DECLSPEC_SUPPORTED
-# else
+# else /* __declspec */
# undef __DECLSPEC_SUPPORTED
# undef __MINGW_IMPORT
-# endif
+# ifndef _CRTIMP
+# define _CRTIMP
+# endif
+# endif /* __declspec */
+# ifndef __cdecl
+# define __cdecl __attribute__((cdecl))
+# endif
+# ifndef __stdcall
+# define __stdcall __attribute__((stdcall))
+# endif
# undef __int64
# define __int64 long long
#endif /* __GNUC__ */
@@ -70,4 +86,3 @@
#define __MINGW32_MINOR_VERSION 0
#endif /* __MINGW_H */
-
diff --git a/winsup/mingw/include/assert.h b/winsup/mingw/include/assert.h
index 07a7d1ffe..893db9113 100644
--- a/winsup/mingw/include/assert.h
+++ b/winsup/mingw/include/assert.h
@@ -49,7 +49,7 @@ extern "C" {
* CRTDLL nicely supplies a function which does the actual output and
* call to abort.
*/
-void _assert (const char*, const char*, int)
+_CRTIMP void __cdecl _assert (const char*, const char*, int)
#ifdef __GNUC__
__attribute__ ((noreturn))
#endif
diff --git a/winsup/mingw/include/conio.h b/winsup/mingw/include/conio.h
index 4e8d55ab6..780ccc10d 100644
--- a/winsup/mingw/include/conio.h
+++ b/winsup/mingw/include/conio.h
@@ -39,26 +39,25 @@
extern "C" {
#endif
+_CRTIMP char* __cdecl _cgets (char*);
+_CRTIMP int __cdecl _cprintf (const char*, ...);
+_CRTIMP int __cdecl _cputs (const char*);
+_CRTIMP int __cdecl _cscanf (char*, ...);
-char* _cgets (char*);
-int _cprintf (const char*, ...);
-int _cputs (const char*);
-int _cscanf (char*, ...);
-
-int _getch (void);
-int _getche (void);
-int _kbhit (void);
-int _putch (int);
-int _ungetch (int);
+_CRTIMP int __cdecl _getch (void);
+_CRTIMP int __cdecl _getche (void);
+_CRTIMP int __cdecl _kbhit (void);
+_CRTIMP int __cdecl _putch (int);
+_CRTIMP int __cdecl _ungetch (int);
#ifndef _NO_OLDNAMES
-int getch (void);
-int getche (void);
-int kbhit (void);
-int putch (int);
-int ungetch (int);
+_CRTIMP int __cdecl getch (void);
+_CRTIMP int __cdecl getche (void);
+_CRTIMP int __cdecl kbhit (void);
+_CRTIMP int __cdecl putch (int);
+_CRTIMP int __cdecl ungetch (int);
#endif /* Not _NO_OLDNAMES */
diff --git a/winsup/mingw/include/ctype.h b/winsup/mingw/include/ctype.h
index fcbb31d77..462fc7bc7 100644
--- a/winsup/mingw/include/ctype.h
+++ b/winsup/mingw/include/ctype.h
@@ -59,25 +59,25 @@
extern "C" {
#endif
-int isalnum(int);
-int isalpha(int);
-int iscntrl(int);
-int isdigit(int);
-int isgraph(int);
-int islower(int);
-int isprint(int);
-int ispunct(int);
-int isspace(int);
-int isupper(int);
-int isxdigit(int);
+_CRTIMP int __cdecl isalnum(int);
+_CRTIMP int __cdecl isalpha(int);
+_CRTIMP int __cdecl iscntrl(int);
+_CRTIMP int __cdecl isdigit(int);
+_CRTIMP int __cdecl isgraph(int);
+_CRTIMP int __cdecl islower(int);
+_CRTIMP int __cdecl isprint(int);
+_CRTIMP int __cdecl ispunct(int);
+_CRTIMP int __cdecl isspace(int);
+_CRTIMP int __cdecl isupper(int);
+_CRTIMP int __cdecl isxdigit(int);
#ifndef __STRICT_ANSI__
-int _isctype (int, int);
+_CRTIMP int __cdecl _isctype (int, int);
#endif
/* These are the ANSI versions, with correct checking of argument */
-int tolower(int);
-int toupper(int);
+_CRTIMP int __cdecl tolower(int);
+_CRTIMP int __cdecl toupper(int);
/*
* NOTE: The above are not old name type wrappers, but functions exported
@@ -89,8 +89,8 @@ int toupper(int);
* These are the cheap non-std versions: The return values are undefined
* if the argument is not ASCII char or is not of appropriate case
*/
-int _tolower(int);
-int _toupper(int);
+_CRTIMP int __cdecl _tolower(int);
+_CRTIMP int __cdecl _toupper(int);
#endif
/* Also defined in stdlib.h */
@@ -152,24 +152,25 @@ extern unsigned short** _imp___ctype;
*/
-#if ! (defined (__NO_CTYPE_INLINES) || defined (__STRICT_ANSI__ ))
+#if ! (defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES) \
+ || defined (__STRICT_ANSI__ ))
/* use simple lookup if SB locale, else _isctype() */
#define __ISCTYPE(c, mask) (MB_CUR_MAX == 1 ? (_pctype[c] & mask) : _isctype(c, mask))
-extern __inline__ int isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));}
-extern __inline__ int isalpha(int c) {return __ISCTYPE(c, _ALPHA);}
-extern __inline__ int iscntrl(int c) {return __ISCTYPE(c, _CONTROL);}
-extern __inline__ int isdigit(int c) {return __ISCTYPE(c, _DIGIT);}
-extern __inline__ int isgraph(int c) {return __ISCTYPE(c, (_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int islower(int c) {return __ISCTYPE(c, _LOWER);}
-extern __inline__ int isprint(int c) {return __ISCTYPE(c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int ispunct(int c) {return __ISCTYPE(c, _PUNCT);}
-extern __inline__ int isspace(int c) {return __ISCTYPE(c, _SPACE);}
-extern __inline__ int isupper(int c) {return __ISCTYPE(c, _UPPER);}
-extern __inline__ int isxdigit(int c) {return __ISCTYPE(c, _HEX);}
+extern __inline__ int __cdecl isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl isalpha(int c) {return __ISCTYPE(c, _ALPHA);}
+extern __inline__ int __cdecl iscntrl(int c) {return __ISCTYPE(c, _CONTROL);}
+extern __inline__ int __cdecl isdigit(int c) {return __ISCTYPE(c, _DIGIT);}
+extern __inline__ int __cdecl isgraph(int c) {return __ISCTYPE(c, (_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl islower(int c) {return __ISCTYPE(c, _LOWER);}
+extern __inline__ int __cdecl isprint(int c) {return __ISCTYPE(c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl ispunct(int c) {return __ISCTYPE(c, _PUNCT);}
+extern __inline__ int __cdecl isspace(int c) {return __ISCTYPE(c, _SPACE);}
+extern __inline__ int __cdecl isupper(int c) {return __ISCTYPE(c, _UPPER);}
+extern __inline__ int __cdecl isxdigit(int c) {return __ISCTYPE(c, _HEX);}
/* these reproduce behaviour of lib underscored versions */
-extern __inline__ int _tolower(int c) {return ( c -'A'+'a');}
-extern __inline__ int _toupper(int c) {return ( c -'a'+'A');}
+extern __inline__ int __cdecl _tolower(int c) {return ( c -'A'+'a');}
+extern __inline__ int __cdecl _toupper(int c) {return ( c -'a'+'A');}
/* TODO? Is it worth inlining ANSI tolower, toupper? Probably only
if we only want C-locale. */
@@ -187,62 +188,64 @@ typedef wchar_t wctype_t;
#define _WCTYPE_T_DEFINED
#endif
-int iswalnum(wint_t);
-int iswalpha(wint_t);
-int iswascii(wint_t);
-int iswcntrl(wint_t);
-int iswctype(wint_t, wctype_t);
-int is_wctype(wint_t, wctype_t); /* Obsolete! */
-int iswdigit(wint_t);
-int iswgraph(wint_t);
-int iswlower(wint_t);
-int iswprint(wint_t);
-int iswpunct(wint_t);
-int iswspace(wint_t);
-int iswupper(wint_t);
-int iswxdigit(wint_t);
-
-wchar_t towlower(wchar_t);
-wchar_t towupper(wchar_t);
-
-int isleadbyte (int);
+_CRTIMP int __cdecl iswalnum(wint_t);
+_CRTIMP int __cdecl iswalpha(wint_t);
+_CRTIMP int __cdecl iswascii(wint_t);
+_CRTIMP int __cdecl iswcntrl(wint_t);
+_CRTIMP int __cdecl iswctype(wint_t, wctype_t);
+_CRTIMP int __cdecl is_wctype(wint_t, wctype_t); /* Obsolete! */
+_CRTIMP int __cdecl iswdigit(wint_t);
+_CRTIMP int __cdecl iswgraph(wint_t);
+_CRTIMP int __cdecl iswlower(wint_t);
+_CRTIMP int __cdecl iswprint(wint_t);
+_CRTIMP int __cdecl iswpunct(wint_t);
+_CRTIMP int __cdecl iswspace(wint_t);
+_CRTIMP int __cdecl iswupper(wint_t);
+_CRTIMP int __cdecl iswxdigit(wint_t);
+
+_CRTIMP wchar_t __cdecl towlower(wchar_t);
+_CRTIMP wchar_t __cdecl towupper(wchar_t);
+
+_CRTIMP int __cdecl isleadbyte (int);
/* Also in wctype.h */
-#if ! (defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED))
+#if ! (defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
+ || defined(__WCTYPE_INLINES_DEFINED))
#define __WCTYPE_INLINES_DEFINED
-extern __inline__ int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
-extern __inline__ int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
-extern __inline__ int iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
-extern __inline__ int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
-extern __inline__ int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
-extern __inline__ int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
-extern __inline__ int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
-extern __inline__ int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
-extern __inline__ int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
-extern __inline__ int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
-extern __inline__ int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
+extern __inline__ int __cdecl iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
+extern __inline__ int __cdecl iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
+extern __inline__ int __cdecl iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
+extern __inline__ int __cdecl iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
+extern __inline__ int __cdecl iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
+extern __inline__ int __cdecl iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
+extern __inline__ int __cdecl iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
+extern __inline__ int __cdecl iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
+extern __inline__ int __cdecl iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
+extern __inline__ int __cdecl isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
#ifndef __STRICT_ANSI__
-int __isascii (int);
-int __toascii (int);
-int __iscsymf (int); /* Valid first character in C symbol */
-int __iscsym (int); /* Valid character in C symbol (after first) */
-
-#ifndef __NO_CTYPE_INLINES
-extern __inline__ int __isascii(int c) {return ((c & ~0x7F) == 0);}
-extern __inline__ int __toascii(int c) {return (c & 0x7F);}
-extern __inline__ int __iscsymf(int c) {return (isalpha(c) || (c == '_'));}
-extern __inline__ int __iscsym(int c) {return (isalnum(c) || (c == '_'));}
+int __cdecl __isascii (int);
+int __cdecl __toascii (int);
+int __cdecl __iscsymf (int); /* Valid first character in C symbol */
+int __cdecl __iscsym (int); /* Valid character in C symbol (after first) */
+
+#if !(defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES))
+extern __inline__ int __cdecl __isascii(int c) {return ((c & ~0x7F) == 0);}
+extern __inline__ int __cdecl __toascii(int c) {return (c & 0x7F);}
+extern __inline__ int __cdecl __iscsymf(int c) {return (isalpha(c) || (c == '_'));}
+extern __inline__ int __cdecl __iscsym(int c) {return (isalnum(c) || (c == '_'));}
#endif /* __NO_CTYPE_INLINES */
#ifndef _NO_OLDNAMES
-int isascii (int);
-int toascii (int);
-int iscsymf (int);
-int iscsym (int);
+/* Not _CRTIMP */
+int __cdecl isascii (int);
+int __cdecl toascii (int);
+int __cdecl iscsymf (int);
+int __cdecl iscsym (int);
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
diff --git a/winsup/mingw/include/direct.h b/winsup/mingw/include/direct.h
index cbd8e9fe1..c8fec4cf4 100644
--- a/winsup/mingw/include/direct.h
+++ b/winsup/mingw/include/direct.h
@@ -61,11 +61,11 @@ struct _diskfree_t {
* You really shouldn't be using these. Use the Win32 API functions instead.
* However, it does make it easier to port older code.
*/
-int _getdrive (void);
-unsigned long _getdrives(void);
-int _chdrive (int);
-char* _getdcwd (int, char*, int);
-unsigned _getdiskfree (unsigned, struct _diskfree_t *);
+_CRTIMP int __cdecl _getdrive (void);
+_CRTIMP unsigned long __cdecl _getdrives(void);
+_CRTIMP int __cdecl _chdrive (int);
+_CRTIMP char* __cdecl _getdcwd (int, char*, int);
+_CRTIMP unsigned __cdecl _getdiskfree (unsigned, struct _diskfree_t *);
#ifndef _NO_OLDNAMES
# define diskfree_t _diskfree_t
@@ -74,11 +74,11 @@ unsigned _getdiskfree (unsigned, struct _diskfree_t *);
#ifndef _WDIRECT_DEFINED
/* wide character versions. Also in wchar.h */
#ifdef __MSVCRT__
-int _wchdir(const wchar_t*);
-wchar_t* _wgetcwd(wchar_t*, int);
-wchar_t* _wgetdcwd(int, wchar_t*, int);
-int _wmkdir(const wchar_t*);
-int _wrmdir(const wchar_t*);
+_CRTIMP int __cdecl _wchdir(const wchar_t*);
+_CRTIMP wchar_t* __cdecl _wgetcwd(wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _wgetdcwd(int, wchar_t*, int);
+_CRTIMP int __cdecl _wmkdir(const wchar_t*);
+_CRTIMP int __cdecl _wrmdir(const wchar_t*);
#endif /* __MSVCRT__ */
#define _WDIRECT_DEFINED
#endif
diff --git a/winsup/mingw/include/dirent.h b/winsup/mingw/include/dirent.h
index 4df6bd997..5a9246a4a 100644
--- a/winsup/mingw/include/dirent.h
+++ b/winsup/mingw/include/dirent.h
@@ -77,12 +77,12 @@ typedef struct
char dd_name[1];
} DIR;
-DIR* opendir (const char*);
-struct dirent* readdir (DIR*);
-int closedir (DIR*);
-void rewinddir (DIR*);
-long telldir (DIR*);
-void seekdir (DIR*, long);
+DIR* __cdecl opendir (const char*);
+struct dirent* __cdecl readdir (DIR*);
+int __cdecl closedir (DIR*);
+void __cdecl rewinddir (DIR*);
+long __cdecl telldir (DIR*);
+void __cdecl seekdir (DIR*, long);
/* wide char versions */
@@ -127,12 +127,12 @@ typedef struct
-_WDIR* _wopendir (const wchar_t*);
-struct _wdirent* _wreaddir (_WDIR*);
-int _wclosedir (_WDIR*);
-void _wrewinddir (_WDIR*);
-long _wtelldir (_WDIR*);
-void _wseekdir (_WDIR*, long);
+_WDIR* __cdecl _wopendir (const wchar_t*);
+struct _wdirent* __cdecl _wreaddir (_WDIR*);
+int __cdecl _wclosedir (_WDIR*);
+void __cdecl _wrewinddir (_WDIR*);
+long __cdecl _wtelldir (_WDIR*);
+void __cdecl _wseekdir (_WDIR*, long);
#ifdef __cplusplus
diff --git a/winsup/mingw/include/dos.h b/winsup/mingw/include/dos.h
index 5374a7a52..4f2134e7e 100644
--- a/winsup/mingw/include/dos.h
+++ b/winsup/mingw/include/dos.h
@@ -92,7 +92,7 @@ struct _diskfree_t {
#define _DISKFREE_T_DEFINED
#endif
-unsigned _getdiskfree (unsigned, struct _diskfree_t *);
+_CRTIMP unsigned __cdecl _getdiskfree (unsigned, struct _diskfree_t *);
#ifndef _NO_OLDNAMES
# define diskfree_t _diskfree_t
diff --git a/winsup/mingw/include/errno.h b/winsup/mingw/include/errno.h
index fdeb8e375..e4669ccec 100644
--- a/winsup/mingw/include/errno.h
+++ b/winsup/mingw/include/errno.h
@@ -104,7 +104,7 @@ extern "C" {
#undef errno
extern int errno;
#else
-int* _errno(void);
+_CRTIMP int* __cdecl _errno(void);
#define errno (*_errno())
#endif
diff --git a/winsup/mingw/include/fenv.h b/winsup/mingw/include/fenv.h
index e27095ff8..43dfd338a 100644
--- a/winsup/mingw/include/fenv.h
+++ b/winsup/mingw/include/fenv.h
@@ -65,23 +65,23 @@ extern "C" {
/*TODO: Some of these could be inlined */
/* 7.6.2 Exception */
-extern int feclearexcept (int);
-extern int fegetexceptflag (fexcept_t * flagp, int excepts);
-extern int feraiseexcept (int excepts );
-extern int fesetexceptflag (const fexcept_t *, int);
-extern int fetestexcept (int excepts);
+extern int __cdecl feclearexcept (int);
+extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
+extern int __cdecl feraiseexcept (int excepts );
+extern int __cdecl fesetexceptflag (const fexcept_t *, int);
+extern int __cdecl fetestexcept (int excepts);
/* 7.6.3 Rounding */
-extern int fegetround (void);
-extern int fesetround (int mode);
+extern int __cdecl fegetround (void);
+extern int __cdecl fesetround (int mode);
/* 7.6.4 Environment */
-extern int fegetenv (fenv_t * envp);
-extern int fesetenv (const fenv_t * );
-extern int feupdateenv (const fenv_t *);
-extern int feholdexcept (fenv_t *);
+extern int __cdecl fegetenv (fenv_t * envp);
+extern int __cdecl fesetenv (const fenv_t * );
+extern int __cdecl feupdateenv (const fenv_t *);
+extern int __cdecl feholdexcept (fenv_t *);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/float.h b/winsup/mingw/include/float.h
index afcc280a9..1e3d4aa82 100644
--- a/winsup/mingw/include/float.h
+++ b/winsup/mingw/include/float.h
@@ -115,12 +115,12 @@ extern "C" {
/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
* i.e. change the bits in unMask to have the values they have in unNew,
* leaving other bits unchanged. */
-unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
-unsigned int _control87 (unsigned int unNew, unsigned int unMask);
+_CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask);
+_CRTIMP unsigned int __cdecl _control87 (unsigned int unNew, unsigned int unMask);
-unsigned int _clearfp (void); /* Clear the FPU status word */
-unsigned int _statusfp (void); /* Report the FPU status word */
+_CRTIMP unsigned int __cdecl _clearfp (void); /* Clear the FPU status word */
+_CRTIMP unsigned int __cdecl _statusfp (void); /* Report the FPU status word */
#define _clear87 _clearfp
#define _status87 _statusfp
@@ -134,11 +134,11 @@ unsigned int _statusfp (void); /* Report the FPU status word */
per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
building your application.
*/
-void _fpreset (void);
-void fpreset (void);
+void __cdecl _fpreset (void);
+void __cdecl fpreset (void);
/* Global 'variable' for the current floating point error code. */
-int * __fpecode(void);
+_CRTIMP int * __cdecl __fpecode(void);
#define _fpecode (*(__fpecode()))
/*
@@ -146,15 +146,15 @@ int * __fpecode(void);
* but they really belong in math.h.
*/
-double _chgsign (double);
-double _copysign (double, double);
-double _logb (double);
-double _nextafter (double, double);
-double _scalb (double, long);
+_CRTIMP double __cdecl _chgsign (double);
+_CRTIMP double __cdecl _copysign (double, double);
+_CRTIMP double __cdecl _logb (double);
+_CRTIMP double __cdecl _nextafter (double, double);
+_CRTIMP double __cdecl _scalb (double, long);
-int _finite (double);
-int _fpclass (double);
-int _isnan (double);
+_CRTIMP int __cdecl _finite (double);
+_CRTIMP int __cdecl _fpclass (double);
+_CRTIMP int __cdecl _isnan (double);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h
index 70efb5f59..ead95fb9b 100644
--- a/winsup/mingw/include/inttypes.h
+++ b/winsup/mingw/include/inttypes.h
@@ -254,19 +254,21 @@ typedef struct {
#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
-extern __inline__ intmax_t imaxabs (intmax_t j)
+extern __inline__ intmax_t __cdecl imaxabs (intmax_t j)
{return (j >= 0 ? j : -j);}
-imaxdiv_t imaxdiv (intmax_t numer, intmax_t denom);
+imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom);
/* 7.8.2 Conversion functions for greatest-width integer types */
-intmax_t strtoimax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
-uintmax_t strtoumax (const char* __restrict__ nptr, char** __restrict__ endptr, int base);
+intmax_t __cdecl strtoimax (const char* __restrict__ nptr,
+ char** __restrict__ endptr, int base);
+uintmax_t __cdecl strtoumax (const char* __restrict__ nptr,
+ char** __restrict__ endptr, int base);
-intmax_t wcstoimax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
- int base);
-uintmax_t wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr,
- int base);
+intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr,
+ wchar_t** __restrict__ endptr, int base);
+uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr,
+ wchar_t** __restrict__ endptr, int base);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h
index 288c3dc16..c2a257b33 100644
--- a/winsup/mingw/include/io.h
+++ b/winsup/mingw/include/io.h
@@ -116,36 +116,36 @@ extern "C" {
* _findclose calls. _findnext also returns -1 if no match could be found,
* and 0 if a match was found. Call _findclose when you are finished.
*/
-int _findfirst (const char*, struct _finddata_t*);
-int _findnext (int, struct _finddata_t*);
-int _findclose (int);
+_CRTIMP int __cdecl _findfirst (const char*, struct _finddata_t*);
+_CRTIMP int __cdecl _findnext (int, struct _finddata_t*);
+_CRTIMP int __cdecl _findclose (int);
-int _chdir (const char*);
-char* _getcwd (char*, int);
-int _mkdir (const char*);
-char* _mktemp (char*);
-int _rmdir (const char*);
-int _chmod (const char*, int);
+_CRTIMP int __cdecl _chdir (const char*);
+_CRTIMP char* __cdecl _getcwd (char*, int);
+_CRTIMP int __cdecl _mkdir (const char*);
+_CRTIMP char* __cdecl _mktemp (char*);
+_CRTIMP int __cdecl _rmdir (const char*);
+_CRTIMP int __cdecl _chmod (const char*, int);
#ifdef __MSVCRT__
-__int64 _filelengthi64(int);
-long _findfirsti64(const char*, struct _finddatai64_t*);
-int _findnexti64(long, struct _finddatai64_t*);
-__int64 _lseeki64(int, __int64, int);
-__int64 _telli64(int);
+_CRTIMP __int64 __cdecl _filelengthi64(int);
+_CRTIMP long __cdecl _findfirsti64(const char*, struct _finddatai64_t*);
+_CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t*);
+_CRTIMP __int64 __cdecl _lseeki64(int, __int64, int);
+_CRTIMP __int64 __cdecl _telli64(int);
#endif /* __MSVCRT__ */
#ifndef _NO_OLDNAMES
#ifndef _UWIN
-int chdir (const char*);
-char* getcwd (char*, int);
-int mkdir (const char*);
-char* mktemp (char*);
-int rmdir (const char*);
-int chmod (const char*, int);
+_CRTIMP int __cdecl chdir (const char*);
+_CRTIMP char* __cdecl getcwd (char*, int);
+_CRTIMP int __cdecl mkdir (const char*);
+_CRTIMP char* __cdecl mktemp (char*);
+_CRTIMP int __cdecl rmdir (const char*);
+_CRTIMP int __cdecl chmod (const char*, int);
#endif /* _UWIN */
#endif /* Not _NO_OLDNAMES */
@@ -176,21 +176,21 @@ int chmod (const char*, int);
extern "C" {
#endif
-int _access (const char*, int);
-int _chsize (int, long);
-int _close (int);
-int _commit(int);
+_CRTIMP int __cdecl _access (const char*, int);
+_CRTIMP int __cdecl _chsize (int, long);
+_CRTIMP int __cdecl _close (int);
+_CRTIMP int __cdecl _commit(int);
/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80),
* the "owner write permission" bit (on FAT). */
-int _creat (const char*, int);
+_CRTIMP int __cdecl _creat (const char*, int);
-int _dup (int);
-int _dup2 (int, int);
-long _filelength (int);
-int _fileno (FILE*);
-long _get_osfhandle (int);
-int _isatty (int);
+_CRTIMP int __cdecl _dup (int);
+_CRTIMP int __cdecl _dup2 (int, int);
+_CRTIMP long __cdecl _filelength (int);
+_CRTIMP int __cdecl _fileno (FILE*);
+_CRTIMP long __cdecl _get_osfhandle (int);
+_CRTIMP int __cdecl _isatty (int);
/* In a very odd turn of events this function is excluded from those
* files which define _STREAM_COMPAT. This is required in order to
@@ -198,47 +198,47 @@ int _isatty (int);
* line 107. Actually I might just be able to change the name of
* the enum member in streambuf.h... we'll see. TODO */
#ifndef _STREAM_COMPAT
-int _eof (int);
+_CRTIMP int __cdecl _eof (int);
#endif
/* LK_... locking commands defined in sys/locking.h. */
-int _locking (int, int, long);
+_CRTIMP int __cdecl _locking (int, int, long);
-long _lseek (int, long, int);
+_CRTIMP long __cdecl _lseek (int, long, int);
/* Optional third argument is unsigned unPermissions. */
-int _open (const char*, int, ...);
+_CRTIMP int __cdecl _open (const char*, int, ...);
-int _open_osfhandle (long, int);
-int _pipe (int *, unsigned int, int);
-int _read (int, void*, unsigned int);
-int _setmode (int, int);
+_CRTIMP int __cdecl _open_osfhandle (long, int);
+_CRTIMP int __cdecl _pipe (int *, unsigned int, int);
+_CRTIMP int __cdecl _read (int, void*, unsigned int);
+_CRTIMP int __cdecl _setmode (int, int);
/* SH_... flags for nShFlags defined in share.h
* Optional fourth argument is unsigned unPermissions */
-int _sopen (const char*, int, int, ...);
+_CRTIMP int __cdecl _sopen (const char*, int, int, ...);
-long _tell (int);
+_CRTIMP long __cdecl _tell (int);
/* Should umask be in sys/stat.h and/or sys/types.h instead? */
-int _umask (int);
-int _unlink (const char*);
-int _write (int, const void*, unsigned int);
+_CRTIMP int __cdecl _umask (int);
+_CRTIMP int __cdecl _unlink (const char*);
+_CRTIMP int __cdecl _write (int, const void*, unsigned int);
/* Wide character versions. Also declared in wchar.h. */
/* Not in crtdll.dll */
#if !defined (_WIO_DEFINED)
#if defined (__MSVCRT__)
-int _waccess(const wchar_t*, int);
-int _wchmod(const wchar_t*, int);
-int _wcreat(const wchar_t*, int);
-long _wfindfirst(const wchar_t*, struct _wfinddata_t*);
-int _wfindnext(long, struct _wfinddata_t *);
-int _wunlink(const wchar_t*);
-int _wopen(const wchar_t*, int, ...);
-int _wsopen(const wchar_t*, int, int, ...);
-wchar_t * _wmktemp(wchar_t*);
-long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnexti64(long, struct _wfinddatai64_t*);
+_CRTIMP int __cdecl _waccess(const wchar_t*, int);
+_CRTIMP int __cdecl _wchmod(const wchar_t*, int);
+_CRTIMP int __cdecl _wcreat(const wchar_t*, int);
+_CRTIMP long __cdecl _wfindfirst(const wchar_t*, struct _wfinddata_t*);
+_CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *);
+_CRTIMP int __cdecl _wunlink(const wchar_t*);
+_CRTIMP int __cdecl _wopen(const wchar_t*, int, ...);
+_CRTIMP int __cdecl _wsopen(const wchar_t*, int, int, ...);
+_CRTIMP wchar_t * __cdecl _wmktemp(wchar_t*);
+_CRTIMP long __cdecl _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*);
+_CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t*);
#endif /* defined (__MSVCRT__) */
#define _WIO_DEFINED
#endif /* _WIO_DEFINED */
@@ -250,25 +250,25 @@ int _wfindnexti64(long, struct _wfinddatai64_t*);
*/
#ifndef _UWIN
-int access (const char*, int);
-int chsize (int, long );
-int close (int);
-int creat (const char*, int);
-int dup (int);
-int dup2 (int, int);
-int eof (int);
-long filelength (int);
-int fileno (FILE*);
-int isatty (int);
-long lseek (int, long, int);
-int open (const char*, int, ...);
-int read (int, void*, unsigned int);
-int setmode (int, int);
-int sopen (const char*, int, int, ...);
-long tell (int);
-int umask (int);
-int unlink (const char*);
-int write (int, const void*, unsigned int);
+_CRTIMP int __cdecl access (const char*, int);
+_CRTIMP int __cdecl chsize (int, long );
+_CRTIMP int __cdecl close (int);
+_CRTIMP int __cdecl creat (const char*, int);
+_CRTIMP int __cdecl dup (int);
+_CRTIMP int __cdecl dup2 (int, int);
+_CRTIMP int __cdecl eof (int);
+_CRTIMP long __cdecl filelength (int);
+_CRTIMP int __cdecl fileno (FILE*);
+_CRTIMP int __cdecl isatty (int);
+_CRTIMP long __cdecl lseek (int, long, int);
+_CRTIMP int __cdecl open (const char*, int, ...);
+_CRTIMP int __cdecl read (int, void*, unsigned int);
+_CRTIMP int __cdecl setmode (int, int);
+_CRTIMP int __cdecl sopen (const char*, int, int, ...);
+_CRTIMP long __cdecl tell (int);
+_CRTIMP int __cdecl umask (int);
+_CRTIMP int __cdecl unlink (const char*);
+_CRTIMP int __cdecl write (int, const void*, unsigned int);
#endif /* _UWIN */
/* Wide character versions. Also declared in wchar.h. */
diff --git a/winsup/mingw/include/locale.h b/winsup/mingw/include/locale.h
index 16fb6119a..3f36388bd 100644
--- a/winsup/mingw/include/locale.h
+++ b/winsup/mingw/include/locale.h
@@ -84,13 +84,13 @@ struct lconv
extern "C" {
#endif
-char* setlocale (int, const char*);
-struct lconv* localeconv (void);
+_CRTIMP char* __cdecl setlocale (int, const char*);
+_CRTIMP struct lconv* __cdecl localeconv (void);
#ifndef _WLOCALE_DEFINED /* also declared in wchar.h */
# define __need_wchar_t
# include <stddef.h>
- wchar_t* _wsetlocale(int, const wchar_t*);
+ _CRTIMP wchar_t* __cdecl _wsetlocale(int, const wchar_t*);
# define _WLOCALE_DEFINED
#endif /* ndef _WLOCALE_DEFINED */
diff --git a/winsup/mingw/include/malloc.h b/winsup/mingw/include/malloc.h
index 097a5e1c1..834e0212f 100644
--- a/winsup/mingw/include/malloc.h
+++ b/winsup/mingw/include/malloc.h
@@ -60,26 +60,26 @@ extern "C" {
The _heap* memory allocation functions are supported on NT
but not W9x. On latter, they always set errno to ENOSYS.
*/
-int _heapwalk (_HEAPINFO*);
+_CRTIMP int __cdecl _heapwalk (_HEAPINFO*);
#ifdef __GNUC__
#define _alloca(x) __builtin_alloca((x))
#endif
#ifndef _NO_OLDNAMES
-int heapwalk (_HEAPINFO*);
+_CRTIMP int __cdecl heapwalk (_HEAPINFO*);
#ifdef __GNUC__
#define alloca(x) __builtin_alloca((x))
#endif
#endif /* Not _NO_OLDNAMES */
-int _heapchk (void); /* Verify heap integrety. */
-int _heapmin (void); /* Return unused heap to the OS. */
-int _heapset (unsigned int);
+_CRTIMP int __cdecl _heapchk (void); /* Verify heap integrety. */
+_CRTIMP int __cdecl _heapmin (void); /* Return unused heap to the OS. */
+_CRTIMP int __cdecl _heapset (unsigned int);
-size_t _msize (void*);
-size_t _get_sbh_threshold (void);
-int _set_sbh_threshold (size_t);
-void * _expand (void*, size_t);
+_CRTIMP size_t __cdecl _msize (void*);
+_CRTIMP size_t __cdecl _get_sbh_threshold (void);
+_CRTIMP int __cdecl _set_sbh_threshold (size_t);
+_CRTIMP void* __cdecl _expand (void*, size_t);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
index 6249d020c..cad49b186 100644
--- a/winsup/mingw/include/math.h
+++ b/winsup/mingw/include/math.h
@@ -146,37 +146,39 @@ struct _exception
};
-double sin (double);
-double cos (double);
-double tan (double);
-double sinh (double);
-double cosh (double);
-double tanh (double);
-double asin (double);
-double acos (double);
-double atan (double);
-double atan2 (double, double);
-double exp (double);
-double log (double);
-double log10 (double);
-double pow (double, double);
-double sqrt (double);
-double ceil (double);
-double floor (double);
-double fabs (double);
-extern __inline__ double fabs (double x)
+_CRTIMP double __cdecl sin (double);
+_CRTIMP double __cdecl cos (double);
+_CRTIMP double __cdecl tan (double);
+_CRTIMP double __cdecl sinh (double);
+_CRTIMP double __cdecl cosh (double);
+_CRTIMP double __cdecl tanh (double);
+_CRTIMP double __cdecl asin (double);
+_CRTIMP double __cdecl acos (double);
+_CRTIMP double __cdecl atan (double);
+_CRTIMP double __cdecl atan2 (double, double);
+_CRTIMP double __cdecl exp (double);
+_CRTIMP double __cdecl log (double);
+_CRTIMP double __cdecl log10 (double);
+_CRTIMP double __cdecl pow (double, double);
+_CRTIMP double __cdecl sqrt (double);
+_CRTIMP double __cdecl ceil (double);
+_CRTIMP double __cdecl floor (double);
+_CRTIMP double __cdecl fabs (double);
+#if !defined (__NO_INLINES__)
+extern __inline__ __cdecl double fabs (double x)
{
double res;
__asm__ ("fabs;" : "=t" (res) : "0" (x));
return res;
}
-double ldexp (double, int);
-double frexp (double, int*);
-double modf (double, double*);
-double fmod (double, double);
+#endif
+_CRTIMP double __cdecl ldexp (double, int);
+_CRTIMP double __cdecl frexp (double, int*);
+_CRTIMP double __cdecl modf (double, double*);
+_CRTIMP double __cdecl fmod (double, double);
-#ifndef __STRICT_ANSI__
+#ifndef __STRICT_ANSI__
/* Complex number (for cabs). This really belongs in complex.h */
struct _complex
@@ -185,16 +187,16 @@ struct _complex
double y; /* Imaginary part */
};
-double _cabs (struct _complex);
+_CRTIMP double __cdecl _cabs (struct _complex);
-double _hypot (double, double);
-double _j0 (double);
-double _j1 (double);
-double _jn (int, double);
-double _y0 (double);
-double _y1 (double);
-double _yn (int, double);
-int _matherr (struct _exception *);
+_CRTIMP double __cdecl _hypot (double, double);
+_CRTIMP double __cdecl _j0 (double);
+_CRTIMP double __cdecl _j1 (double);
+_CRTIMP double __cdecl _jn (int, double);
+_CRTIMP double __cdecl _y0 (double);
+_CRTIMP double __cdecl _y1 (double);
+_CRTIMP double __cdecl _yn (int, double);
+_CRTIMP int __cdecl _matherr (struct _exception *);
/* These are also declared in Mingw float.h; needed here as well to work
around GCC build issues. */
@@ -203,15 +205,15 @@ int _matherr (struct _exception *);
* IEEE recommended functions
*/
-double _chgsign (double);
-double _copysign (double, double);
-double _logb (double);
-double _nextafter (double, double);
-double _scalb (double, long);
+_CRTIMP double __cdecl _chgsign (double);
+_CRTIMP double __cdecl _copysign (double, double);
+_CRTIMP double __cdecl _logb (double);
+_CRTIMP double __cdecl _nextafter (double, double);
+_CRTIMP double __cdecl _scalb (double, long);
-int _finite (double);
-int _fpclass (double);
-int _isnan (double);
+_CRTIMP int __cdecl _finite (double);
+_CRTIMP int __cdecl _fpclass (double);
+_CRTIMP int __cdecl _isnan (double);
/* END FLOAT.H COPY */
@@ -223,27 +225,27 @@ int _isnan (double);
#if !defined (_NO_OLDNAMES)
-double cabs (struct _complex);
-double j0 (double);
-double j1 (double);
-double jn (int, double);
-double y0 (double);
-double y1 (double);
-double yn (int, double);
+_CRTIMP double __cdecl cabs (struct _complex);
+_CRTIMP double __cdecl j0 (double);
+_CRTIMP double __cdecl j1 (double);
+_CRTIMP double __cdecl jn (int, double);
+_CRTIMP double __cdecl y0 (double);
+_CRTIMP double __cdecl y1 (double);
+_CRTIMP double __cdecl yn (int, double);
-double chgsign (double);
-double scalb (double, long);
-int finite (double);
-int fpclass (double);
+_CRTIMP double __cdecl chgsign (double);
+_CRTIMP double __cdecl scalb (double, long);
+_CRTIMP int __cdecl finite (double);
+_CRTIMP int __cdecl fpclass (double);
-#endif /* Not _NO_OLDNAMES */
+#endif /* Not _NO_OLDNAMES */
#endif /* __STRICT_ANSI__ */
#ifndef __NO_ISOCEXT
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
- || !defined __STRICT_ANSI__ || defined __GLIBCPP__
+ || !defined __STRICT_ANSI__ || defined __GLIBCPP__
#define NAN (0.0F/0.0F)
#define HUGE_VALF (1.0F/0.0F)
@@ -273,10 +275,10 @@ int fpclass (double);
converted to double, and zero when converted to float.)
*/
-extern int __fpclassifyf (float);
-extern int __fpclassify (double);
+extern int __cdecl __fpclassifyf (float);
+extern int __cdecl __fpclassify (double);
-extern __inline__ int __fpclassifyl (long double x){
+extern __inline__ int __cdecl __fpclassifyl (long double x){
unsigned short sw;
__asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
@@ -296,7 +298,7 @@ extern __inline__ int __fpclassifyl (long double x){
/* We don't need to worry about trucation here:
A NaN stays a NaN. */
-extern __inline__ int __isnan (double _x)
+extern __inline__ int __cdecl __isnan (double _x)
{
unsigned short sw;
__asm__ ("fxam;"
@@ -305,7 +307,7 @@ extern __inline__ int __isnan (double _x)
== FP_NAN;
}
-extern __inline__ int __isnanf (float _x)
+extern __inline__ int __cdecl __isnanf (float _x)
{
unsigned short sw;
__asm__ ("fxam;"
@@ -314,7 +316,7 @@ extern __inline__ int __isnanf (float _x)
== FP_NAN;
}
-extern __inline__ int __isnanl (long double _x)
+extern __inline__ int __cdecl __isnanl (long double _x)
{
unsigned short sw;
__asm__ ("fxam;"
@@ -332,120 +334,120 @@ extern __inline__ int __isnanl (long double _x)
#define isnormal(x) (fpclassify(x) == FP_NORMAL)
/* 7.12.3.6 The signbit macro */
-extern __inline__ int __signbit (double x) {
+extern __inline__ int __cdecl __signbit (double x) {
unsigned short stw;
__asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
return stw & 0x0200;
}
-extern __inline__ int __signbitf (float x) {
+extern __inline__ int __cdecl __signbitf (float x) {
unsigned short stw;
__asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
return stw & 0x0200;
}
-extern __inline__ int __signbitl (long double x) {
+
+extern __inline__ int __cdecl __signbitl (long double x) {
unsigned short stw;
__asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
return stw & 0x0200;
}
-
#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \
: sizeof (x) == sizeof (double) ? __signbit (x) \
: __signbitl (x))
/* 7.12.4 Trigonometric functions: Double in C89 */
-extern float sinf (float);
-extern long double sinl (long double);
+extern float __cdecl sinf (float);
+extern long double __cdecl sinl (long double);
-extern float cosf (float);
-extern long double cosl (long double);
+extern float __cdecl cosf (float);
+extern long double __cdecl cosl (long double);
-extern float tanf (float);
-extern long double tanl (long double);
+extern float __cdecl tanf (float);
+extern long double __cdecl tanl (long double);
-extern float asinf (float);
-extern long double asinl (long double);
+extern float __cdecl asinf (float);
+extern long double __cdecl asinl (long double);
-extern float acosf (float);
-extern long double acosl (long double);
+extern float __cdecl acosf (float);
+extern long double __cdecl acosl (long double);
-extern float atanf (float);
-extern long double atanl (long double);
+extern float __cdecl atanf (float);
+extern long double __cdecl atanl (long double);
-extern float atan2f (float, float);
-extern long double atan2l (long double, long double);
+extern float __cdecl atan2f (float, float);
+extern long double __cdecl atan2l (long double, long double);
/* 7.12.5 Hyperbolic functions: Double in C89 */
-extern __inline__ float sinhf (float x)
+extern __inline__ float __cdecl sinhf (float x)
{return (float) sinh (x);}
-extern long double sinhl (long double);
+extern long double __cdecl sinhl (long double);
-extern __inline__ float coshf (float x)
+extern __inline__ float __cdecl coshf (float x)
{return (float) cosh (x);}
-extern long double coshl (long double);
+extern long double __cdecl coshl (long double);
-extern __inline__ float tanhf (float x)
+extern __inline__ float __cdecl tanhf (float x)
{return (float) tanh (x);}
-extern long double tanhl (long double);
+extern long double __cdecl tanhl (long double);
/*
* TODO: asinh, acosh, atanh
*/
/* 7.12.6.1 Double in C89 */
-extern __inline__ float expf (float x)
+extern __inline__ float __cdecl expf (float x)
{return (float) exp (x);}
-extern long double expl (long double);
+extern long double __cdecl expl (long double);
/* 7.12.6.2 */
-extern double exp2(double);
-extern float exp2f(float);
-extern long double exp2l(long double);
+extern double __cdecl exp2(double);
+extern float __cdecl exp2f(float);
+extern long double __cdecl exp2l(long double);
/* 7.12.6.3 The expm1 functions: TODO */
/* 7.12.6.4 Double in C89 */
-extern __inline__ float frexpf (float x, int* expn)
+extern __inline__ float __cdecl frexpf (float x, int* expn)
{return (float) frexp (x, expn);}
-extern long double frexpl (long double, int*);
+extern long double __cdecl frexpl (long double, int*);
/* 7.12.6.5 */
#define FP_ILOGB0 ((int)0x80000000)
#define FP_ILOGBNAN ((int)0x80000000)
-extern int ilogb (double);
-extern int ilogbf (float);
-extern int ilogbl (long double);
+extern int __cdecl ilogb (double);
+extern int __cdecl ilogbf (float);
+extern int __cdecl ilogbl (long double);
/* 7.12.6.6 Double in C89 */
-extern __inline__ float ldexpf (float x, int expn)
+extern __inline__ float __cdecl ldexpf (float x, int expn)
{return (float) ldexp (x, expn);}
-extern long double ldexpl (long double, int);
+extern long double __cdecl ldexpl (long double, int);
/* 7.12.6.7 Double in C89 */
-extern float logf (float);
-extern long double logl (long double);
+extern float __cdecl logf (float);
+extern long double __cdecl logl (long double);
/* 7.12.6.8 Double in C89 */
-extern float log10f (float);
-extern long double log10l (long double);
+extern float __cdecl log10f (float);
+extern long double __cdecl log10l (long double);
/* 7.12.6.9 */
-extern double log1p(double);
-extern float log1pf(float);
-extern long double log1pl(long double);
+extern double __cdecl log1p(double);
+extern float __cdecl log1pf(float);
+extern long double __cdecl log1pl(long double);
/* 7.12.6.10 */
-extern double log2 (double);
-extern float log2f (float);
-extern long double log2l (long double);
+extern double __cdecl log2 (double);
+extern float __cdecl log2f (float);
+extern long double __cdecl log2l (long double);
/* 7.12.6.11 */
-extern double logb (double);
-extern float logbf (float);
-extern long double logbl (long double);
+extern double __cdecl logb (double);
+extern float __cdecl logbf (float);
+extern long double __cdecl logbl (long double);
-extern __inline__ double logb (double x)
+extern __inline__ double __cdecl logb (double x)
{
double res;
__asm__ ("fxtract\n\t"
@@ -453,7 +455,7 @@ extern __inline__ double logb (double x)
return res;
}
-extern __inline__ float logbf (float x)
+extern __inline__ float __cdecl logbf (float x)
{
float res;
__asm__ ("fxtract\n\t"
@@ -461,7 +463,7 @@ extern __inline__ float logbf (float x)
return res;
}
-extern __inline__ long double logbl (long double x)
+extern __inline__ long double __cdecl logbl (long double x)
{
long double res;
__asm__ ("fxtract\n\t"
@@ -470,33 +472,33 @@ extern __inline__ long double logbl (long double x)
}
/* 7.12.6.12 Double in C89 */
-extern float modff (float, float*);
-extern long double modfl (long double, long double*);
+extern float __cdecl modff (float, float*);
+extern long double __cdecl modfl (long double, long double*);
/* 7.12.6.13 */
-extern double scalbn (double, int);
-extern float scalbnf (float, int);
-extern long double scalbnl (long double, int);
+extern double __cdecl scalbn (double, int);
+extern float __cdecl scalbnf (float, int);
+extern long double __cdecl scalbnl (long double, int);
-extern double scalbln (double, long);
-extern float scalblnf (float, long);
-extern long double scalblnl (long double, long);
+extern double __cdecl scalbln (double, long);
+extern float __cdecl scalblnf (float, long);
+extern long double __cdecl scalblnl (long double, long);
/* 7.12.7.1 */
/* Implementations adapted from Cephes versions */
-extern double cbrt (double);
-extern float cbrtf (float);
-extern long double cbrtl (long double);
+extern double __cdecl cbrt (double);
+extern float __cdecl cbrtf (float);
+extern long double __cdecl cbrtl (long double);
/* 7.12.7.2 The fabs functions: Double in C89 */
-extern __inline__ float fabsf (float x)
+extern __inline__ float __cdecl fabsf (float x)
{
float res;
__asm__ ("fabs;" : "=t" (res) : "0" (x));
return res;
}
-extern __inline__ long double fabsl (long double x)
+extern __inline__ long double __cdecl fabsl (long double x)
{
long double res;
__asm__ ("fabs;" : "=t" (res) : "0" (x));
@@ -504,74 +506,74 @@ extern __inline__ long double fabsl (long double x)
}
/* 7.12.7.3 */
-extern double hypot (double, double); /* in libmoldname.a */
-extern __inline__ float hypotf (float x, float y)
+extern double __cdecl hypot (double, double); /* in libmoldname.a */
+extern __inline__ float __cdecl hypotf (float x, float y)
{ return (float) hypot (x, y);}
-extern long double hypotl (long double, long double);
+extern long double __cdecl hypotl (long double, long double);
/* 7.12.7.4 The pow functions. Double in C89 */
-extern __inline__ float powf (float x, float y)
+extern __inline__ float __cdecl powf (float x, float y)
{return (float) pow (x, y);}
-extern long double powl (long double, long double);
+extern long double __cdecl powl (long double, long double);
/* 7.12.7.5 The sqrt functions. Double in C89. */
-extern float sqrtf (float);
-extern long double sqrtl (long double);
+extern float __cdecl sqrtf (float);
+extern long double __cdecl sqrtl (long double);
/* 7.12.8.1 The erf functions */
-extern double erf (double);
-extern float erff (float);
+extern double __cdecl erf (double);
+extern float __cdecl erff (float);
/* TODO
-extern long double erfl (long double);
+extern long double __cdecl erfl (long double);
*/
/* 7.12.8.2 The erfc functions */
-extern double erfc (double);
-extern float erfcf (float);
+extern double __cdecl erfc (double);
+extern float __cdecl erfcf (float);
/* TODO
-extern long double erfcl (long double);
+extern long double __cdecl erfcl (long double);
*/
/* 7.12.8.3 The lgamma functions */
-extern double lgamma (double);
-extern float lgammaf (float);
-extern long double lgammal (long double);
+extern double __cdecl lgamma (double);
+extern float __cdecl lgammaf (float);
+extern long double __cdecl lgammal (long double);
/* 7.12.8.4 The tgamma functions */
-extern double tgamma (double);
-extern float tgammaf (float);
-extern long double tgammal (long double);
+extern double __cdecl tgamma (double);
+extern float __cdecl tgammaf (float);
+extern long double __cdecl tgammal (long double);
/* 7.12.9.1 Double in C89 */
-extern float ceilf (float);
-extern long double ceill (long double);
+extern float __cdecl ceilf (float);
+extern long double __cdecl ceill (long double);
/* 7.12.9.2 Double in C89 */
-extern float floorf (float);
-extern long double floorl (long double);
+extern float __cdecl floorf (float);
+extern long double __cdecl floorl (long double);
/* 7.12.9.3 */
-extern double nearbyint ( double);
-extern float nearbyintf (float);
-extern long double nearbyintl (long double);
+extern double __cdecl nearbyint ( double);
+extern float __cdecl nearbyintf (float);
+extern long double __cdecl nearbyintl (long double);
/* 7.12.9.4 */
/* round, using fpu control word settings */
-extern __inline__ double rint (double x)
+extern __inline__ double __cdecl rint (double x)
{
double retval;
__asm__ ("frndint;": "=t" (retval) : "0" (x));
return retval;
}
-extern __inline__ float rintf (float x)
+extern __inline__ float __cdecl rintf (float x)
{
float retval;
__asm__ ("frndint;" : "=t" (retval) : "0" (x) );
return retval;
}
-extern __inline__ long double rintl (long double x)
+extern __inline__ long double __cdecl rintl (long double x)
{
long double retval;
__asm__ ("frndint;" : "=t" (retval) : "0" (x) );
@@ -579,7 +581,7 @@ extern __inline__ long double rintl (long double x)
}
/* 7.12.9.5 */
-extern __inline__ long lrint (double x)
+extern __inline__ long __cdecl lrint (double x)
{
long retval;
__asm__ __volatile__ \
@@ -587,7 +589,7 @@ extern __inline__ long lrint (double x)
return retval;
}
-extern __inline__ long lrintf (float x)
+extern __inline__ long __cdecl lrintf (float x)
{
long retval;
__asm__ __volatile__ \
@@ -595,7 +597,7 @@ extern __inline__ long lrintf (float x)
return retval;
}
-extern __inline__ long lrintl (long double x)
+extern __inline__ long __cdecl lrintl (long double x)
{
long retval;
__asm__ __volatile__ \
@@ -603,7 +605,7 @@ extern __inline__ long lrintl (long double x)
return retval;
}
-extern __inline__ long long llrint (double x)
+extern __inline__ long long __cdecl llrint (double x)
{
long long retval;
__asm__ __volatile__ \
@@ -611,7 +613,7 @@ extern __inline__ long long llrint (double x)
return retval;
}
-extern __inline__ long long llrintf (float x)
+extern __inline__ long long __cdecl llrintf (float x)
{
long long retval;
__asm__ __volatile__ \
@@ -619,7 +621,7 @@ extern __inline__ long long llrintf (float x)
return retval;
}
-extern __inline__ long long llrintl (long double x)
+extern __inline__ long long __cdecl llrintl (long double x)
{
long long retval;
__asm__ __volatile__ \
@@ -629,48 +631,48 @@ extern __inline__ long long llrintl (long double x)
/* 7.12.9.6 */
/* round away from zero, regardless of fpu control word settings */
-extern double round (double);
-extern float roundf (float);
-extern long double roundl (long double);
+extern double __cdecl round (double);
+extern float __cdecl roundf (float);
+extern long double __cdecl roundl (long double);
/* 7.12.9.7 */
-extern long lround (double);
-extern long lroundf (float);
-extern long lroundl (long double);
+extern long __cdecl lround (double);
+extern long __cdecl lroundf (float);
+extern long __cdecl lroundl (long double);
-extern long long llround (double);
-extern long long llroundf (float);
-extern long long llroundl (long double);
+extern long long __cdecl llround (double);
+extern long long __cdecl llroundf (float);
+extern long long __cdecl llroundl (long double);
/* 7.12.9.8 */
/* round towards zero, regardless of fpu control word settings */
-extern double trunc (double);
-extern float truncf (float);
-extern long double truncl (long double);
+extern double __cdecl trunc (double);
+extern float __cdecl truncf (float);
+extern long double __cdecl truncl (long double);
/* 7.12.10.1 Double in C89 */
-extern float fmodf (float, float);
-extern long double fmodl (long double, long double);
+extern float __cdecl fmodf (float, float);
+extern long double __cdecl fmodl (long double, long double);
/* 7.12.10.2 */
-extern double remainder (double, double);
-extern float remainderf (float, float);
-extern long double remainderl (long double, long double);
+extern double __cdecl remainder (double, double);
+extern float __cdecl remainderf (float, float);
+extern long double __cdecl remainderl (long double, long double);
/* 7.12.10.3 */
-extern double remquo(double, double, int *);
-extern float remquof(float, float, int *);
-extern long double remquol(long double, long double, int *);
+extern double __cdecl remquo(double, double, int *);
+extern float __cdecl remquof(float, float, int *);
+extern long double __cdecl remquol(long double, long double, int *);
/* 7.12.11.1 */
-extern double copysign (double, double); /* in libmoldname.a */
-extern float copysignf (float, float);
-extern long double copysignl (long double, long double);
+extern double __cdecl copysign (double, double); /* in libmoldname.a */
+extern float __cdecl copysignf (float, float);
+extern long double __cdecl copysignl (long double, long double);
/* 7.12.11.2 Return a NaN */
-extern double nan(const char *tagp);
-extern float nanf(const char *tagp);
-extern long double nanl(const char *tagp);
+extern double __cdecl nan(const char *tagp);
+extern float __cdecl nanf(const char *tagp);
+extern long double __cdecl nanl(const char *tagp);
#ifndef __STRICT_ANSI__
#define _nan() nan("")
@@ -679,18 +681,18 @@ extern long double nanl(const char *tagp);
#endif
/* 7.12.11.3 */
-extern double nextafter (double, double); /* in libmoldname.a */
-extern float nextafterf (float, float);
+extern double __cdecl nextafter (double, double); /* in libmoldname.a */
+extern float __cdecl nextafterf (float, float);
/* TODO: Not yet implemented */
-/* extern long double nextafterl (long double, long double); */
+/* extern long double __cdecl nextafterl (long double, long double); */
/* 7.12.11.4 The nexttoward functions: TODO */
/* 7.12.12.1 */
/* x > y ? (x - y) : 0.0 */
-extern double fdim (double x, double y);
-extern float fdimf (float x, float y);
-extern long double fdiml (long double x, long double y);
+extern double __cdecl fdim (double x, double y);
+extern float __cdecl fdimf (float x, float y);
+extern long double __cdecl fdiml (long double x, long double y);
/* fmax and fmin.
NaN arguments are treated as missing data: if one argument is a NaN
@@ -698,20 +700,20 @@ extern long double fdiml (long double x, long double y);
value. */
/* 7.12.12.2 */
-extern double fmax (double, double);
-extern float fmaxf (float, float);
-extern long double fmaxl (long double, long double);
+extern double __cdecl fmax (double, double);
+extern float __cdecl fmaxf (float, float);
+extern long double __cdecl fmaxl (long double, long double);
/* 7.12.12.3 */
-extern double fmin (double, double);
-extern float fminf (float, float);
-extern long double fminl (long double, long double);
+extern double __cdecl fmin (double, double);
+extern float __cdecl fminf (float, float);
+extern long double __cdecl fminl (long double, long double);
/* 7.12.13.1 */
/* return x * y + z as a ternary op */
-extern double fma (double, double, double);
-extern float fmaf (float, float, float);
-extern long double fmal (long double, long double, long double);
+extern double __cdecl fma (double, double, double);
+extern float __cdecl fmaf (float, float, float);
+extern long double __cdecl fmal (long double, long double, long double);
/* 7.12.14 */
@@ -734,7 +736,7 @@ extern long double fmal (long double, long double, long double);
#else
/* helper */
-extern __inline__ int
+extern __inline__ int __cdecl
__fp_unordered_compare (long double x, long double y){
unsigned short retval;
__asm__ ("fucom %%st(1);"
diff --git a/winsup/mingw/include/mbctype.h b/winsup/mingw/include/mbctype.h
index 346e6d790..dd57a7b5c 100644
--- a/winsup/mingw/include/mbctype.h
+++ b/winsup/mingw/include/mbctype.h
@@ -54,29 +54,29 @@ extern "C" {
#ifndef __STRICT_ANSI__
-int _setmbcp (int);
-int _getmbcp (void);
+_CRTIMP int __cdecl _setmbcp (int);
+_CRTIMP int __cdecl _getmbcp (void);
/* byte classification */
/* NB: Corresponding _ismbc* functions are in mbstring.h */
-int _ismbbalpha (unsigned int);
-int _ismbbalnum (unsigned int);
-int _ismbbgraph (unsigned int);
-int _ismbbprint (unsigned int);
-int _ismbbpunct (unsigned int);
+_CRTIMP int __cdecl _ismbbalpha (unsigned int);
+_CRTIMP int __cdecl _ismbbalnum (unsigned int);
+_CRTIMP int __cdecl _ismbbgraph (unsigned int);
+_CRTIMP int __cdecl _ismbbprint (unsigned int);
+_CRTIMP int __cdecl _ismbbpunct (unsigned int);
-int _ismbbkana (unsigned int);
-int _ismbbkalnum (unsigned int);
-int _ismbbkprint (unsigned int);
-int _ismbbkpunct (unsigned int);
+_CRTIMP int __cdecl _ismbbkana (unsigned int);
+_CRTIMP int __cdecl _ismbbkalnum (unsigned int);
+_CRTIMP int __cdecl _ismbbkprint (unsigned int);
+_CRTIMP int __cdecl _ismbbkpunct (unsigned int);
/* these are also in mbstring.h */
-int _ismbblead (unsigned int);
-int _ismbbtrail (unsigned int);
-int _ismbslead (const unsigned char*, const unsigned char*);
-int _ismbstrail (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _ismbblead (unsigned int);
+_CRTIMP int __cdecl _ismbbtrail (unsigned int);
+_CRTIMP int __cdecl _ismbslead (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _ismbstrail (const unsigned char*, const unsigned char*);
#ifdef __DECLSPEC_SUPPORTED
__MINGW_IMPORT unsigned char _mbctype[];
diff --git a/winsup/mingw/include/mbstring.h b/winsup/mingw/include/mbstring.h
index 6b89ebd76..4ad777602 100644
--- a/winsup/mingw/include/mbstring.h
+++ b/winsup/mingw/include/mbstring.h
@@ -36,89 +36,89 @@ extern "C" {
#ifndef __STRICT_ANSI__
/* character classification */
-int _ismbcalnum (unsigned int);
-int _ismbcalpha (unsigned int);
-int _ismbcdigit (unsigned int);
-int _ismbcgraph (unsigned int);
-int _ismbcprint (unsigned int);
-int _ismbcpunct (unsigned int);
-int _ismbcspace (unsigned int);
-int _ismbclower (unsigned int);
-int _ismbcupper (unsigned int);
-int _ismbclegal (unsigned int);
-int _ismbcsymbol (unsigned int);
+_CRTIMP int __cdecl _ismbcalnum (unsigned int);
+_CRTIMP int __cdecl _ismbcalpha (unsigned int);
+_CRTIMP int __cdecl _ismbcdigit (unsigned int);
+_CRTIMP int __cdecl _ismbcgraph (unsigned int);
+_CRTIMP int __cdecl _ismbcprint (unsigned int);
+_CRTIMP int __cdecl _ismbcpunct (unsigned int);
+_CRTIMP int __cdecl _ismbcspace (unsigned int);
+_CRTIMP int __cdecl _ismbclower (unsigned int);
+_CRTIMP int __cdecl _ismbcupper (unsigned int);
+_CRTIMP int __cdecl _ismbclegal (unsigned int);
+_CRTIMP int __cdecl _ismbcsymbol (unsigned int);
/* also in mbctype.h */
-int _ismbblead (unsigned int );
-int _ismbbtrail (unsigned int );
-int _ismbslead ( const unsigned char*, const unsigned char*);
-int _ismbstrail ( const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _ismbblead (unsigned int );
+_CRTIMP int __cdecl _ismbbtrail (unsigned int );
+_CRTIMP int __cdecl _ismbslead ( const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _ismbstrail ( const unsigned char*, const unsigned char*);
-unsigned int _mbctolower (unsigned int);
-unsigned int _mbctoupper (unsigned int);
+_CRTIMP unsigned int __cdecl _mbctolower (unsigned int);
+_CRTIMP unsigned int __cdecl _mbctoupper (unsigned int);
-void _mbccpy (unsigned char*, const unsigned char*);
-size_t _mbclen (const unsigned char*);
+_CRTIMP void __cdecl _mbccpy (unsigned char*, const unsigned char*);
+_CRTIMP size_t __cdecl _mbclen (const unsigned char*);
-unsigned int _mbbtombc (unsigned int);
-unsigned int _mbctombb (unsigned int);
+_CRTIMP unsigned int __cdecl _mbbtombc (unsigned int);
+_CRTIMP unsigned int __cdecl _mbctombb (unsigned int);
/* Return value constants for these are defined in mbctype.h. */
-int _mbbtype (unsigned char, int);
-int _mbsbtype (const unsigned char*, size_t);
-
-unsigned char* _mbscpy (unsigned char*, const unsigned char*);
-unsigned char* _mbsncpy (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsnbcpy (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsset (unsigned char*, unsigned int);
-unsigned char* _mbsnset (unsigned char*, unsigned int, size_t);
-unsigned char* _mbsnbset (unsigned char*, unsigned int, size_t);
-unsigned char* _mbsdup (const unsigned char*);
-unsigned char* _mbsrev (unsigned char*);
-unsigned char* _mbscat (unsigned char*, const unsigned char*);
-unsigned char* _mbsncat (unsigned char*, const unsigned char*, size_t);
-unsigned char* _mbsnbcat (unsigned char*, const unsigned char*, size_t);
-size_t _mbslen (const unsigned char*);
-size_t _mbsnbcnt (const unsigned char*, size_t);
-size_t _mbsnccnt (const unsigned char*, size_t);
-unsigned char* _mbschr (const unsigned char*, unsigned int);
-unsigned char* _mbsrchr (const unsigned char*, unsigned int);
-size_t _mbsspn (const unsigned char*, const unsigned char*);
-size_t _mbscspn (const unsigned char*, const unsigned char*);
-unsigned char* _mbsspnp (const unsigned char*, const unsigned char*);
-unsigned char* _mbspbrk (const unsigned char*, const unsigned char*);
-int _mbscmp (const unsigned char*, const unsigned char*);
-int _mbsicmp (const unsigned char*, const unsigned char*);
-int _mbsncmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnicmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbcmp (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbicmp (const unsigned char*, const unsigned char*, size_t);
-int _mbscoll (const unsigned char*, const unsigned char*);
-int _mbsicoll (const unsigned char*, const unsigned char*);
-int _mbsncoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnicoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbcoll (const unsigned char*, const unsigned char*, size_t);
-int _mbsnbicoll (const unsigned char*, const unsigned char*, size_t);
-
-unsigned char* _mbsinc (const unsigned char*);
-unsigned char* _mbsninc (const unsigned char*, size_t);
-unsigned char* _mbsdec (const unsigned char*, const unsigned char*);
-unsigned int _mbsnextc (const unsigned char*);
-unsigned char* _mbslwr (unsigned char*);
-unsigned char* _mbsupr (unsigned char*);
-unsigned char* _mbstok (unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbbtype (unsigned char, int);
+_CRTIMP int __cdecl _mbsbtype (const unsigned char*, size_t);
+
+_CRTIMP unsigned char* __cdecl _mbscpy (unsigned char*, const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsncpy (unsigned char*, const unsigned char*, size_t);
+_CRTIMP unsigned char* __cdecl _mbsnbcpy (unsigned char*, const unsigned char*, size_t);
+_CRTIMP unsigned char* __cdecl _mbsset (unsigned char*, unsigned int);
+_CRTIMP unsigned char* __cdecl _mbsnset (unsigned char*, unsigned int, size_t);
+_CRTIMP unsigned char* __cdecl _mbsnbset (unsigned char*, unsigned int, size_t);
+_CRTIMP unsigned char* __cdecl _mbsdup (const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsrev (unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbscat (unsigned char*, const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsncat (unsigned char*, const unsigned char*, size_t);
+_CRTIMP unsigned char* __cdecl _mbsnbcat (unsigned char*, const unsigned char*, size_t);
+_CRTIMP size_t __cdecl _mbslen (const unsigned char*);
+_CRTIMP size_t __cdecl _mbsnbcnt (const unsigned char*, size_t);
+_CRTIMP size_t __cdecl _mbsnccnt (const unsigned char*, size_t);
+_CRTIMP unsigned char* __cdecl _mbschr (const unsigned char*, unsigned int);
+_CRTIMP unsigned char* __cdecl _mbsrchr (const unsigned char*, unsigned int);
+_CRTIMP size_t __cdecl _mbsspn (const unsigned char*, const unsigned char*);
+_CRTIMP size_t __cdecl _mbscspn (const unsigned char*, const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsspnp (const unsigned char*, const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbspbrk (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbscmp (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbsicmp (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbsncmp (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnicmp (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnbcmp (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnbicmp (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbscoll (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbsicoll (const unsigned char*, const unsigned char*);
+_CRTIMP int __cdecl _mbsncoll (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnicoll (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnbcoll (const unsigned char*, const unsigned char*, size_t);
+_CRTIMP int __cdecl _mbsnbicoll (const unsigned char*, const unsigned char*, size_t);
+
+_CRTIMP unsigned char* __cdecl _mbsinc (const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsninc (const unsigned char*, size_t);
+_CRTIMP unsigned char* __cdecl _mbsdec (const unsigned char*, const unsigned char*);
+_CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbslwr (unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbsupr (unsigned char*);
+_CRTIMP unsigned char* __cdecl _mbstok (unsigned char*, const unsigned char*);
/* Kanji */
-int _ismbchira (unsigned int);
-int _ismbckata (unsigned int);
-int _ismbcl0 (unsigned int);
-int _ismbcl1 (unsigned int);
-int _ismbcl2 (unsigned int);
-unsigned int _mbcjistojms (unsigned int);
-unsigned int _mbcjmstojis (unsigned int);
-unsigned int _mbctohira (unsigned int);
-unsigned int _mbctokata (unsigned int);
+_CRTIMP int __cdecl _ismbchira (unsigned int);
+_CRTIMP int __cdecl _ismbckata (unsigned int);
+_CRTIMP int __cdecl _ismbcl0 (unsigned int);
+_CRTIMP int __cdecl _ismbcl1 (unsigned int);
+_CRTIMP int __cdecl _ismbcl2 (unsigned int);
+_CRTIMP unsigned int __cdecl _mbcjistojms (unsigned int);
+_CRTIMP unsigned int __cdecl _mbcjmstojis (unsigned int);
+_CRTIMP unsigned int __cdecl _mbctohira (unsigned int);
+_CRTIMP unsigned int __cdecl _mbctokata (unsigned int);
#endif /* Not strict ANSI */
diff --git a/winsup/mingw/include/process.h b/winsup/mingw/include/process.h
index adf19e8cd..3fb8ed7e0 100644
--- a/winsup/mingw/include/process.h
+++ b/winsup/mingw/include/process.h
@@ -73,30 +73,30 @@
extern "C" {
#endif
-void _cexit(void);
-void _c_exit(void);
-
-int _cwait (int*, _pid_t, int);
-
-_pid_t _getpid(void);
-
-int _execl (const char*, const char*, ...);
-int _execle (const char*, const char*, ...);
-int _execlp (const char*, const char*, ...);
-int _execlpe (const char*, const char*, ...);
-int _execv (const char*, char* const*);
-int _execve (const char*, char* const*, char* const*);
-int _execvp (const char*, char* const*);
-int _execvpe (const char*, char* const*, char* const*);
-
-int _spawnl (int, const char*, const char*, ...);
-int _spawnle (int, const char*, const char*, ...);
-int _spawnlp (int, const char*, const char*, ...);
-int _spawnlpe (int, const char*, const char*, ...);
-int _spawnv (int, const char*, char* const*);
-int _spawnve (int, const char*, char* const*, char* const*);
-int _spawnvp (int, const char*, char* const*);
-int _spawnvpe (int, const char*, char* const*, char* const*);
+_CRTIMP void __cdecl _cexit(void);
+_CRTIMP void __cdecl _c_exit(void);
+
+_CRTIMP int __cdecl _cwait (int*, _pid_t, int);
+
+_CRTIMP _pid_t __cdecl _getpid(void);
+
+_CRTIMP int __cdecl _execl (const char*, const char*, ...);
+_CRTIMP int __cdecl _execle (const char*, const char*, ...);
+_CRTIMP int __cdecl _execlp (const char*, const char*, ...);
+_CRTIMP int __cdecl _execlpe (const char*, const char*, ...);
+_CRTIMP int __cdecl _execv (const char*, char* const*);
+_CRTIMP int __cdecl _execve (const char*, char* const*, char* const*);
+_CRTIMP int __cdecl _execvp (const char*, char* const*);
+_CRTIMP int __cdecl _execvpe (const char*, char* const*, char* const*);
+
+_CRTIMP int __cdecl _spawnl (int, const char*, const char*, ...);
+_CRTIMP int __cdecl _spawnle (int, const char*, const char*, ...);
+_CRTIMP int __cdecl _spawnlp (int, const char*, const char*, ...);
+_CRTIMP int __cdecl _spawnlpe (int, const char*, const char*, ...);
+_CRTIMP int __cdecl _spawnv (int, const char*, char* const*);
+_CRTIMP int __cdecl _spawnve (int, const char*, char* const*, char* const*);
+_CRTIMP int __cdecl _spawnvp (int, const char*, char* const*);
+_CRTIMP int __cdecl _spawnvpe (int, const char*, char* const*, char* const*);
/*
* The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
@@ -109,15 +109,15 @@ int _spawnvpe (int, const char*, char* const*, char* const*);
*
* NOTE: No old names for these functions. Use the underscore.
*/
-unsigned long
+_CRTIMP unsigned long __cdecl
_beginthread (void (*)(void *), unsigned, void*);
-void _endthread (void);
+_CRTIMP void __cdecl _endthread (void);
#ifdef __MSVCRT__
-unsigned long
+_CRTIMP unsigned long __cdecl
_beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *),
void*, unsigned, unsigned*);
-void _endthreadex (unsigned);
+_CRTIMP void __cdecl _endthreadex (unsigned);
#endif
@@ -126,24 +126,24 @@ void _endthreadex (unsigned);
* Functions without the leading underscore, for portability. These functions
* live in liboldnames.a.
*/
-int cwait (int*, pid_t, int);
-pid_t getpid (void);
-int execl (const char*, const char*, ...);
-int execle (const char*, const char*, ...);
-int execlp (const char*, const char*, ...);
-int execlpe (const char*, const char*, ...);
-int execv (const char*, char* const*);
-int execve (const char*, char* const*, char* const*);
-int execvp (const char*, char* const*);
-int execvpe (const char*, char* const*, char* const*);
-int spawnl (int, const char*, const char*, ...);
-int spawnle (int, const char*, const char*, ...);
-int spawnlp (int, const char*, const char*, ...);
-int spawnlpe (int, const char*, const char*, ...);
-int spawnv (int, const char*, char* const*);
-int spawnve (int, const char*, char* const*, char* const*);
-int spawnvp (int, const char*, char* const*);
-int spawnvpe (int, const char*, char* const*, char* const*);
+_CRTIMP int __cdecl cwait (int*, pid_t, int);
+_CRTIMP pid_t __cdecl getpid (void);
+_CRTIMP int __cdecl execl (const char*, const char*, ...);
+_CRTIMP int __cdecl execle (const char*, const char*, ...);
+_CRTIMP int __cdecl execlp (const char*, const char*, ...);
+_CRTIMP int __cdecl execlpe (const char*, const char*, ...);
+_CRTIMP int __cdecl execv (const char*, char* const*);
+_CRTIMP int __cdecl execve (const char*, char* const*, char* const*);
+_CRTIMP int __cdecl execvp (const char*, char* const*);
+_CRTIMP int __cdecl execvpe (const char*, char* const*, char* const*);
+_CRTIMP int __cdecl spawnl (int, const char*, const char*, ...);
+_CRTIMP int __cdecl spawnle (int, const char*, const char*, ...);
+_CRTIMP int __cdecl spawnlp (int, const char*, const char*, ...);
+_CRTIMP int __cdecl spawnlpe (int, const char*, const char*, ...);
+_CRTIMP int __cdecl spawnv (int, const char*, char* const*);
+_CRTIMP int __cdecl spawnve (int, const char*, char* const*, char* const*);
+_CRTIMP int __cdecl spawnvp (int, const char*, char* const*);
+_CRTIMP int __cdecl spawnvpe (int, const char*, char* const*, char* const*);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
diff --git a/winsup/mingw/include/setjmp.h b/winsup/mingw/include/setjmp.h
index 89f045f60..91a650c34 100644
--- a/winsup/mingw/include/setjmp.h
+++ b/winsup/mingw/include/setjmp.h
@@ -52,7 +52,7 @@ typedef _JBTYPE jmp_buf[_JBLEN];
* The function provided by CRTDLL which appears to do the actual work
* of setjmp.
*/
-int _setjmp (jmp_buf);
+_CRTIMP int __cdecl _setjmp (jmp_buf);
#define setjmp(x) _setjmp(x)
@@ -60,7 +60,7 @@ int _setjmp (jmp_buf);
* Return to the last setjmp call and act as if setjmp had returned
* nVal (which had better be non-zero!).
*/
-void longjmp (jmp_buf, int);
+_CRTIMP void __cdecl longjmp (jmp_buf, int);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/signal.h b/winsup/mingw/include/signal.h
index 4298accb7..b0a817334 100644
--- a/winsup/mingw/include/signal.h
+++ b/winsup/mingw/include/signal.h
@@ -94,12 +94,12 @@ extern "C" {
* previous handler, or SIG_ERR if an error occurs. Initially
* unhandled signals defined above will return SIG_DFL.
*/
-__p_sig_fn_t signal(int, __p_sig_fn_t);
+_CRTIMP __p_sig_fn_t __cdecl signal(int, __p_sig_fn_t);
/*
* Raise the signal indicated by sig. Returns non-zero on success.
*/
-int raise (int);
+_CRTIMP int __cdecl raise (int);
#ifdef __cplusplus
}
diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h
index 6196cc044..6fad92c88 100644
--- a/winsup/mingw/include/stdio.h
+++ b/winsup/mingw/include/stdio.h
@@ -131,11 +131,13 @@
#ifndef RC_INVOKED
+#ifndef __VALIST
#ifdef __GNUC__
#define __VALIST __gnuc_va_list
#else
#define __VALIST char*
#endif
+#endif /* defined __VALIST */
/*
* The structure underlying the FILE type.
@@ -186,41 +188,41 @@ extern "C" {
/*
* File Operations
*/
-FILE* fopen (const char*, const char*);
-FILE* freopen (const char*, const char*, FILE*);
-int fflush (FILE*);
-int fclose (FILE*);
+_CRTIMP FILE* __cdecl fopen (const char*, const char*);
+_CRTIMP FILE* __cdecl freopen (const char*, const char*, FILE*);
+_CRTIMP int __cdecl fflush (FILE*);
+_CRTIMP int __cdecl fclose (FILE*);
/* MS puts remove & rename (but not wide versions) in io.h also */
-int remove (const char*);
-int rename (const char*, const char*);
-FILE* tmpfile (void);
-char* tmpnam (char*);
-char* _tempnam (const char*, const char*);
+_CRTIMP int __cdecl remove (const char*);
+_CRTIMP int __cdecl rename (const char*, const char*);
+_CRTIMP FILE* __cdecl tmpfile (void);
+_CRTIMP char* __cdecl tmpnam (char*);
+_CRTIMP char* __cdecl _tempnam (const char*, const char*);
#ifndef NO_OLDNAMES
-char* tempnam (const char*, const char*);
+_CRTIMP char* __cdecl tempnam (const char*, const char*);
#endif
-int setvbuf (FILE*, char*, int, size_t);
+_CRTIMP int __cdecl setvbuf (FILE*, char*, int, size_t);
-void setbuf (FILE*, char*);
+_CRTIMP void __cdecl setbuf (FILE*, char*);
/*
* Formatted Output
*/
-int fprintf (FILE*, const char*, ...);
-int printf (const char*, ...);
-int sprintf (char*, const char*, ...);
-int _snprintf (char*, size_t, const char*, ...);
-int vfprintf (FILE*, const char*, __VALIST);
-int vprintf (const char*, __VALIST);
-int vsprintf (char*, const char*, __VALIST);
-int _vsnprintf (char*, size_t, const char*, __VALIST);
+_CRTIMP int __cdecl fprintf (FILE*, const char*, ...);
+_CRTIMP int __cdecl printf (const char*, ...);
+_CRTIMP int __cdecl sprintf (char*, const char*, ...);
+_CRTIMP int __cdecl _snprintf (char*, size_t, const char*, ...);
+_CRTIMP int __cdecl vfprintf (FILE*, const char*, __VALIST);
+_CRTIMP int __cdecl vprintf (const char*, __VALIST);
+_CRTIMP int __cdecl vsprintf (char*, const char*, __VALIST);
+_CRTIMP int __cdecl _vsnprintf (char*, size_t, const char*, __VALIST);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snprintf(char* s, size_t n, const char* format, ...);
-extern __inline__ int vsnprintf (char* s, size_t n, const char* format,
+int __cdecl snprintf(char* s, size_t n, const char* format, ...);
+extern __inline__ int __cdecl vsnprintf (char* s, size_t n, const char* format,
__VALIST arg)
{ return _vsnprintf ( s, n, format, arg); }
#endif
@@ -229,39 +231,39 @@ extern __inline__ int vsnprintf (char* s, size_t n, const char* format,
* Formatted Input
*/
-int fscanf (FILE*, const char*, ...);
-int scanf (const char*, ...);
-int sscanf (const char*, const char*, ...);
+_CRTIMP int __cdecl fscanf (FILE*, const char*, ...);
+_CRTIMP int __cdecl scanf (const char*, ...);
+_CRTIMP int __cdecl sscanf (const char*, const char*, ...);
/*
* Character Input and Output Functions
*/
-int fgetc (FILE*);
-char* fgets (char*, int, FILE*);
-int fputc (int, FILE*);
-int fputs (const char*, FILE*);
-int getc (FILE*);
-int getchar (void);
-char* gets (char*);
-int putc (int, FILE*);
-int putchar (int);
-int puts (const char*);
-int ungetc (int, FILE*);
+_CRTIMP int __cdecl fgetc (FILE*);
+_CRTIMP char* __cdecl fgets (char*, int, FILE*);
+_CRTIMP int __cdecl fputc (int, FILE*);
+_CRTIMP int __cdecl fputs (const char*, FILE*);
+_CRTIMP int __cdecl getc (FILE*);
+_CRTIMP int __cdecl getchar (void);
+_CRTIMP char* __cdecl gets (char*);
+_CRTIMP int __cdecl putc (int, FILE*);
+_CRTIMP int __cdecl putchar (int);
+_CRTIMP int __cdecl puts (const char*);
+_CRTIMP int __cdecl ungetc (int, FILE*);
/*
* Direct Input and Output Functions
*/
-size_t fread (void*, size_t, size_t, FILE*);
-size_t fwrite (const void*, size_t, size_t, FILE*);
+_CRTIMP size_t __cdecl fread (void*, size_t, size_t, FILE*);
+_CRTIMP size_t __cdecl fwrite (const void*, size_t, size_t, FILE*);
/*
* File Positioning Functions
*/
-int fseek (FILE*, long, int);
-long ftell (FILE*);
-void rewind (FILE*);
+_CRTIMP int __cdecl fseek (FILE*, long, int);
+_CRTIMP long __cdecl ftell (FILE*);
+_CRTIMP void __cdecl rewind (FILE*);
#ifdef __USE_MINGW_FSEEK /* These are in libmingwex.a */
/*
@@ -269,8 +271,8 @@ void rewind (FILE*);
* not zero'd out if you seek past the end and then write.
*/
-int __mingw_fseek (FILE *, long, int);
-int __mingw_fwrite (const void*, size_t, size_t, FILE*);
+int __cdecl __mingw_fseek (FILE *, long, int);
+int __cdecl __mingw_fwrite (const void*, size_t, size_t, FILE*);
#define fseek(fp, offset, whence) __mingw_fseek(fp, offset, whence)
#define fwrite(buffer, size, count, fp) __mingw_fwrite(buffer, size, count, fp)
#endif /* __USE_MINGW_FSEEK */
@@ -290,50 +292,50 @@ typedef long long fpos_t;
typedef long fpos_t;
#endif
-int fgetpos (FILE*, fpos_t*);
-int fsetpos (FILE*, const fpos_t*);
+_CRTIMP int __cdecl fgetpos (FILE*, fpos_t*);
+_CRTIMP int __cdecl fsetpos (FILE*, const fpos_t*);
/*
* Error Functions
*/
-void clearerr (FILE*);
-int feof (FILE*);
-int ferror (FILE*);
-void perror (const char*);
+_CRTIMP void __cdecl clearerr (FILE*);
+_CRTIMP int __cdecl feof (FILE*);
+_CRTIMP int __cdecl ferror (FILE*);
+_CRTIMP void __cdecl perror (const char*);
#ifndef __STRICT_ANSI__
/*
* Pipes
*/
-FILE* _popen (const char*, const char*);
-int _pclose (FILE*);
+_CRTIMP FILE* __cdecl _popen (const char*, const char*);
+_CRTIMP int __cdecl _pclose (FILE*);
#ifndef NO_OLDNAMES
-FILE* popen (const char*, const char*);
-int pclose (FILE*);
+_CRTIMP FILE* __cdecl popen (const char*, const char*);
+_CRTIMP int __cdecl pclose (FILE*);
#endif
/*
* Other Non ANSI functions
*/
-int _flushall (void);
-int _fgetchar (void);
-int _fputchar (int);
-FILE* _fdopen (int, const char*);
-int _fileno (FILE*);
-int _fcloseall(void);
+_CRTIMP int __cdecl _flushall (void);
+_CRTIMP int __cdecl _fgetchar (void);
+_CRTIMP int __cdecl _fputchar (int);
+_CRTIMP FILE* __cdecl _fdopen (int, const char*);
+_CRTIMP int __cdecl _fileno (FILE*);
+_CRTIMP int __cdecl _fcloseall(void);
#ifdef __MSVCRT__
-int _getmaxstdio(void);
-int _setmaxstdio(int);
+_CRTIMP int __cdecl _getmaxstdio(void);
+_CRTIMP int __cdecl _setmaxstdio(int);
#endif
#ifndef _NO_OLDNAMES
-int fgetchar (void);
-int fputchar (int);
-FILE* fdopen (int, const char*);
-int fileno (FILE*);
+_CRTIMP int __cdecl fgetchar (void);
+_CRTIMP int __cdecl fputchar (int);
+_CRTIMP FILE* __cdecl fdopen (int, const char*);
+_CRTIMP int __cdecl fileno (FILE*);
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
@@ -342,44 +344,44 @@ int fileno (FILE*);
#ifndef _WSTDIO_DEFINED
/* also in wchar.h - keep in sync */
-int fwprintf (FILE*, const wchar_t*, ...);
-int wprintf (const wchar_t*, ...);
-int swprintf (wchar_t*, const wchar_t*, ...);
-int _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int vfwprintf (FILE*, const wchar_t*, __VALIST);
-int vwprintf (const wchar_t*, __VALIST);
-int vswprintf (wchar_t*, const wchar_t*, __VALIST);
-int _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
-int fwscanf (FILE*, const wchar_t*, ...);
-int wscanf (const wchar_t*, ...);
-int swscanf (const wchar_t*, const wchar_t*, ...);
-wint_t fgetwc (FILE*);
-wint_t fputwc (wchar_t, FILE*);
-wint_t ungetwc (wchar_t, FILE*);
+_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...);
+_CRTIMP int __cdecl wprintf (const wchar_t*, ...);
+_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
+_CRTIMP int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
+_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VALIST);
+_CRTIMP int __cdecl vwprintf (const wchar_t*, __VALIST);
+_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VALIST);
+_CRTIMP int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
+_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...);
+_CRTIMP int __cdecl wscanf (const wchar_t*, ...);
+_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
+_CRTIMP wint_t __cdecl fgetwc (FILE*);
+_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
+_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
#ifdef __MSVCRT__
-wchar_t* fgetws (wchar_t*, int, FILE*);
-int fputws (const wchar_t*, FILE*);
-wint_t getwc (FILE*);
-wint_t getwchar (void);
-wchar_t* _getws (wchar_t*);
-wint_t putwc (wint_t, FILE*);
-int _putws (const wchar_t*);
-wint_t putwchar (wint_t);
-FILE* _wfdopen(int, wchar_t *);
-FILE* _wfopen (const wchar_t*, const wchar_t*);
-FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
-FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
-wchar_t* _wtmpnam (wchar_t*);
-wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
-int _wrename (const wchar_t*, const wchar_t*);
-int _wremove (const wchar_t*);
-void _wperror (const wchar_t*);
-FILE* _wpopen (const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
+_CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
+_CRTIMP wint_t __cdecl getwc (FILE*);
+_CRTIMP wint_t __cdecl getwchar (void);
+_CRTIMP wchar_t* __cdecl _getws (wchar_t*);
+_CRTIMP wint_t __cdecl putwc (wint_t, FILE*);
+_CRTIMP int __cdecl _putws (const wchar_t*);
+_CRTIMP wint_t __cdecl putwchar (wint_t);
+_CRTIMP FILE* __cdecl _wfdopen(int, wchar_t *);
+_CRTIMP FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*);
+_CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
+_CRTIMP FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl _wremove (const wchar_t*);
+_CRTIMP void __cdecl _wperror (const wchar_t*);
+_CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*);
#endif /* __MSVCRT__ */
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
-extern __inline__ int
+int __cdecl snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
+extern __inline__ int __cdecl
vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
{ return _vsnwprintf ( s, n, format, arg);}
#endif
@@ -390,23 +392,23 @@ vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
#ifndef __STRICT_ANSI__
#ifdef __MSVCRT__
#ifndef NO_OLDNAMES
-FILE* wpopen (const wchar_t*, const wchar_t*);
+_CRTIMP FILE* __cdecl wpopen (const wchar_t*, const wchar_t*);
#endif /* not NO_OLDNAMES */
#endif /* MSVCRT runtime */
/*
* Other Non ANSI wide functions
*/
-wint_t _fgetwchar (void);
-wint_t _fputwchar (wint_t);
-int _getw (FILE*);
-int _putw (int, FILE*);
+_CRTIMP wint_t __cdecl _fgetwchar (void);
+_CRTIMP wint_t __cdecl _fputwchar (wint_t);
+_CRTIMP int __cdecl _getw (FILE*);
+_CRTIMP int __cdecl _putw (int, FILE*);
#ifndef _NO_OLDNAMES
-wint_t fgetwchar (void);
-wint_t fputwchar (wint_t);
-int getw (FILE*);
-int putw (int, FILE*);
+_CRTIMP wint_t __cdecl fgetwchar (void);
+_CRTIMP wint_t __cdecl fputwchar (wint_t);
+_CRTIMP int __cdecl getw (FILE*);
+_CRTIMP int __cdecl putw (int, FILE*);
#endif /* Not _NO_OLDNAMES */
#endif /* __STRICT_ANSI */
diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h
index bd335c74a..f63711d71 100644
--- a/winsup/mingw/include/stdlib.h
+++ b/winsup/mingw/include/stdlib.h
@@ -89,9 +89,9 @@ extern char** _argv;
/* imports from runtime dll of the above variables */
#ifdef __MSVCRT__
-extern int* __p___argc(void);
-extern char*** __p___argv(void);
-extern wchar_t*** __p___wargv(void);
+extern int* __cdecl __p___argc(void);
+extern char*** __cdecl __p___argv(void);
+extern wchar_t*** __cdecl __p___wargv(void);
#define __argc (*__p___argc())
#define __argv (*__p___argv())
@@ -149,10 +149,10 @@ __MINGW_IMPORT char** __argv_dll;
#undef errno
extern int errno;
#else
-int* _errno(void);
+ _CRTIMP int* __cdecl _errno(void);
#define errno (*_errno())
#endif
-int* __doserrno(void);
+ _CRTIMP int* __cdecl __doserrno(void);
#define _doserrno (*__doserrno())
/*
@@ -160,8 +160,8 @@ int* __doserrno(void);
*/
#ifdef __MSVCRT__
- extern char *** __p__environ(void);
- extern wchar_t *** __p__wenviron(void);
+ extern _CRTIMP char *** __cdecl __p__environ(void);
+ extern _CRTIMP wchar_t *** __cdecl __p__wenviron(void);
# define _environ (*__p__environ())
# define _wenviron (*__p__wenviron())
#else /* ! __MSVCRT__ */
@@ -221,10 +221,10 @@ __MINGW_IMPORT char* _sys_errlist[];
#ifdef __MSVCRT__
/* msvcrtxx.dll */
-extern unsigned int* __p__osver(void);
-extern unsigned int* __p__winver(void);
-extern unsigned int* __p__winmajor(void);
-extern unsigned int* __p__winminor(void);
+extern _CRTIMP unsigned __cdecl int* __p__osver(void);
+extern _CRTIMP unsigned __cdecl int* __p__winver(void);
+extern _CRTIMP unsigned __cdecl int* __p__winmajor(void);
+extern _CRTIMP unsigned __cdecl int* __p__winminor(void);
#ifndef __DECLSPEC_SUPPORTED
# define _osver (*__p__osver())
@@ -272,9 +272,9 @@ __MINGW_IMPORT unsigned int _winminor_dll;
#if defined __MSVCRT__
/* although the _pgmptr is exported as DATA,
* be safe and use the access function __p__pgmptr() to get it. */
-char** __p__pgmptr(void);
+_CRTIMP char** __cdecl __p__pgmptr(void);
#define _pgmptr (*__p__pgmptr())
-wchar_t** __p__wpgmptr(void);
+_CRTIMP wchar_t** __cdecl __p__wpgmptr(void);
#define _wpgmptr (*__p__wpgmptr())
#else /* ! __MSVCRT__ */
# ifndef __DECLSPEC_SUPPORTED
@@ -321,65 +321,67 @@ __MINGW_IMPORT int _fmode_dll;
#define _ATTRIB_NORETURN
#endif /* __GNUC__ */
-double atof (const char*);
-int atoi (const char*);
-long atol (const char*);
-int _wtoi (const wchar_t *);
-long _wtol (const wchar_t *);
+_CRTIMP double __cdecl atof (const char*);
+_CRTIMP int __cdecl atoi (const char*);
+_CRTIMP long __cdecl atol (const char*);
+_CRTIMP int __cdecl _wtoi (const wchar_t *);
+_CRTIMP long __cdecl _wtol (const wchar_t *);
-double strtod (const char*, char**);
-#if !defined __NO_ISOCEXT /* extern stubs in static libmingwex.a */
-extern __inline__ float strtof (const char *nptr, char **endptr)
+_CRTIMP double __cdecl strtod (const char*, char**);
+#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
+extern __inline__ float __cdecl strtof (const char *nptr, char **endptr)
{ return (strtod (nptr, endptr));}
-long double strtold (const char * __restrict__, char ** __restrict__);
+long double __cdecl strtold (const char * __restrict__, char ** __restrict__);
#endif /* __NO_ISOCEXT */
-long strtol (const char*, char**, int);
-unsigned long strtoul (const char*, char**, int);
+_CRTIMP long __cdecl strtol (const char*, char**, int);
+_CRTIMP unsigned long __cdecl strtoul (const char*, char**, int);
#ifndef _WSTDLIB_DEFINED
/* also declared in wchar.h */
-double wcstod (const wchar_t*, wchar_t**);
+_CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**);
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
+extern __inline__ float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr)
{ return (wcstod(nptr, endptr)); }
-long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
+long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
#endif /* __NO_ISOCEXT */
-long wcstol (const wchar_t*, wchar_t**, int);
-unsigned long wcstoul (const wchar_t*, wchar_t**, int);
+_CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int);
+_CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int);
#define _WSTDLIB_DEFINED
#endif
-size_t wcstombs (char*, const wchar_t*, size_t);
-int wctomb (char*, wchar_t);
+_CRTIMP size_t __cdecl wcstombs (char*, const wchar_t*, size_t);
+_CRTIMP int __cdecl wctomb (char*, wchar_t);
-int mblen (const char*, size_t);
-size_t mbstowcs (wchar_t*, const char*, size_t);
-int mbtowc (wchar_t*, const char*, size_t);
+_CRTIMP int __cdecl mblen (const char*, size_t);
+_CRTIMP size_t __cdecl mbstowcs (wchar_t*, const char*, size_t);
+_CRTIMP int __cdecl mbtowc (wchar_t*, const char*, size_t);
-int rand (void);
-void srand (unsigned int);
+_CRTIMP int __cdecl rand (void);
+_CRTIMP void __cdecl srand (unsigned int);
-void* calloc (size_t, size_t);
-void* malloc (size_t);
-void* realloc (void*, size_t);
-void free (void*);
+_CRTIMP void* __cdecl calloc (size_t, size_t);
+_CRTIMP void* __cdecl malloc (size_t);
+_CRTIMP void* __cdecl realloc (void*, size_t);
+_CRTIMP void __cdecl free (void*);
-void abort (void) _ATTRIB_NORETURN;
-void exit (int) _ATTRIB_NORETURN;
-int atexit (void (*)(void));
+_CRTIMP void __cdecl abort (void) _ATTRIB_NORETURN;
+_CRTIMP void __cdecl exit (int) _ATTRIB_NORETURN;
-int system (const char*);
-char* getenv (const char*);
+/* Note: This in startup code, not imported directly from dll */
+int __cdecl atexit (void (*)(void));
-void* bsearch (const void*, const void*, size_t, size_t,
- int (*)(const void*, const void*));
-void qsort (const void*, size_t, size_t,
- int (*)(const void*, const void*));
+_CRTIMP int __cdecl system (const char*);
+_CRTIMP char* __cdecl getenv (const char*);
-int abs (int);
-long labs (long);
+_CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t,
+ int (*)(const void*, const void*));
+_CRTIMP void __cdecl qsort (const void*, size_t, size_t,
+ int (*)(const void*, const void*));
+
+_CRTIMP int __cdecl abs (int);
+_CRTIMP long __cdecl labs (long);
/*
* div_t and ldiv_t are structures used to return the results of div and
@@ -392,8 +394,8 @@ long labs (long);
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
-div_t div (int, int);
-ldiv_t ldiv (long, long);
+_CRTIMP div_t __cdecl div (int, int);
+_CRTIMP ldiv_t __cdecl ldiv (long, long);
#ifndef __STRICT_ANSI__
@@ -401,74 +403,75 @@ ldiv_t ldiv (long, long);
* NOTE: Officially the three following functions are obsolete. The Win32 API
* functions SetErrorMode, Beep and Sleep are their replacements.
*/
-void _beep (unsigned int, unsigned int);
-void _seterrormode (int);
-void _sleep (unsigned long);
+_CRTIMP void __cdecl _beep (unsigned int, unsigned int);
+_CRTIMP void __cdecl _seterrormode (int);
+_CRTIMP void __cdecl _sleep (unsigned long);
-void _exit (int) _ATTRIB_NORETURN;
+_CRTIMP void __cdecl _exit (int) _ATTRIB_NORETURN;
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
/* C99 function name */
-void _Exit(int) _ATTRIB_NORETURN; /* Declare to get noreturn attribute. */
-extern __inline__ void _Exit(int status)
+void __cdecl _Exit(int) _ATTRIB_NORETURN; /* Declare to get noreturn attribute. */
+extern __inline__ void __cdecl _Exit(int status)
{ _exit(status); }
#endif
/* _onexit is MS extension. Use atexit for portability. */
+/* Note: This is in startup code, not imported directly from dll */
typedef int (* _onexit_t)(void);
-_onexit_t _onexit( _onexit_t );
+_onexit_t __cdecl _onexit( _onexit_t );
-int _putenv (const char*);
-void _searchenv (const char*, const char*, char*);
+_CRTIMP int __cdecl _putenv (const char*);
+_CRTIMP void __cdecl _searchenv (const char*, const char*, char*);
-char* _ecvt (double, int, int*, int*);
-char* _fcvt (double, int, int*, int*);
-char* _gcvt (double, int, char*);
+_CRTIMP char* __cdecl _ecvt (double, int, int*, int*);
+_CRTIMP char* __cdecl _fcvt (double, int, int*, int*);
+_CRTIMP char* __cdecl _gcvt (double, int, char*);
-void _makepath (char*, const char*, const char*, const char*, const char*);
-void _splitpath (const char*, char*, char*, char*, char*);
-char* _fullpath (char*, const char*, size_t);
+_CRTIMP void __cdecl _makepath (char*, const char*, const char*, const char*, const char*);
+_CRTIMP void __cdecl _splitpath (const char*, char*, char*, char*, char*);
+_CRTIMP char* __cdecl _fullpath (char*, const char*, size_t);
-char* _itoa (int, char*, int);
-char* _ltoa (long, char*, int);
-char* _ultoa(unsigned long, char*, int);
-wchar_t* _itow (int, wchar_t*, int);
-wchar_t* _ltow (long, wchar_t*, int);
-wchar_t* _ultow (unsigned long, wchar_t*, int);
+_CRTIMP char* __cdecl _itoa (int, char*, int);
+_CRTIMP char* __cdecl _ltoa (long, char*, int);
+_CRTIMP char* __cdecl _ultoa(unsigned long, char*, int);
+_CRTIMP wchar_t* __cdecl _itow (int, wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _ltow (long, wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _ultow (unsigned long, wchar_t*, int);
#ifdef __MSVCRT__
-__int64 _atoi64(const char *);
-char* _i64toa(__int64, char *, int);
-char* _ui64toa(unsigned __int64, char *, int);
-__int64 _wtoi64(const wchar_t *);
-wchar_t* _i64tow(__int64, wchar_t *, int);
-wchar_t* _ui64tow(unsigned __int64, wchar_t *, int);
-
-wchar_t* _wgetenv(const wchar_t*);
-int _wputenv(const wchar_t*);
-void _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
-void _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
-void _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
-wchar_t* _wfullpath (wchar_t*, const wchar_t*, size_t);
-
-unsigned int _rotl(unsigned int, int);
-unsigned int _rotr(unsigned int, int);
-unsigned long _lrotl(unsigned long, int);
-unsigned long _lrotr(unsigned long, int);
+_CRTIMP __int64 __cdecl _atoi64(const char *);
+_CRTIMP char* __cdecl _i64toa(__int64, char *, int);
+_CRTIMP char* __cdecl _ui64toa(unsigned __int64, char *, int);
+_CRTIMP __int64 __cdecl _wtoi64(const wchar_t *);
+_CRTIMP wchar_t* __cdecl _i64tow(__int64, wchar_t *, int);
+_CRTIMP wchar_t* __cdecl _ui64tow(unsigned __int64, wchar_t *, int);
+
+_CRTIMP wchar_t* __cdecl _wgetenv(const wchar_t*);
+_CRTIMP int __cdecl _wputenv(const wchar_t*);
+_CRTIMP void __cdecl _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
+_CRTIMP void __cdecl _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
+_CRTIMP void __cdecl _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
+_CRTIMP wchar_t* __cdecl _wfullpath (wchar_t*, const wchar_t*, size_t);
+
+_CRTIMP unsigned int __cdecl _rotl(unsigned int, int);
+_CRTIMP unsigned int __cdecl _rotr(unsigned int, int);
+_CRTIMP unsigned long __cdecl _lrotl(unsigned long, int);
+_CRTIMP unsigned long __cdecl _lrotr(unsigned long, int);
#endif
#ifndef _NO_OLDNAMES
-int putenv (const char*);
-void searchenv (const char*, const char*, char*);
+_CRTIMP int __cdecl putenv (const char*);
+_CRTIMP void __cdecl searchenv (const char*, const char*, char*);
-char* itoa (int, char*, int);
-char* ltoa (long, char*, int);
+_CRTIMP char* __cdecl itoa (int, char*, int);
+_CRTIMP char* __cdecl ltoa (long, char*, int);
#ifndef _UWIN
-char* ecvt (double, int, int*, int*);
-char* fcvt (double, int, int*, int*);
-char* gcvt (double, int, char*);
+_CRTIMP char* __cdecl ecvt (double, int, int*, int*);
+_CRTIMP char* __cdecl fcvt (double, int, int*, int*);
+_CRTIMP char* __cdecl gcvt (double, int, char*);
#endif /* _UWIN */
#endif /* Not _NO_OLDNAMES */
@@ -480,36 +483,36 @@ char* gcvt (double, int, char*);
typedef struct { long long quot, rem; } lldiv_t;
-lldiv_t lldiv (long long, long long);
+lldiv_t __cdecl lldiv (long long, long long);
-extern __inline__ long long llabs(long long _j)
+extern __inline__ long long __cdecl llabs(long long _j)
{return (_j >= 0 ? _j : -_j);}
-long long strtoll (const char* __restrict__, char** __restrict, int);
-unsigned long long strtoull (const char* __restrict__, char** __restrict__, int);
+long long __cdecl strtoll (const char* __restrict__, char** __restrict, int);
+unsigned long long __cdecl strtoull (const char* __restrict__, char** __restrict__, int);
#if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */
-long long atoll (const char *);
+long long __cdecl atoll (const char *);
#if !defined (__STRICT_ANSI__)
-long long wtoll(const wchar_t *);
-char* lltoa(long long, char *, int);
-char* ulltoa(unsigned long long , char *, int);
-wchar_t* lltow(long long, wchar_t *, int);
-wchar_t* ulltow(unsigned long long, wchar_t *, int);
+long long __cdecl wtoll (const wchar_t *);
+char* __cdecl lltoa (long long, char *, int);
+char* __cdecl ulltoa (unsigned long long , char *, int);
+wchar_t* __cdecl lltow (long long, wchar_t *, int);
+wchar_t* __cdecl ulltow (unsigned long long, wchar_t *, int);
/* inline using non-ansi functions */
-extern __inline__ long long atoll (const char * _c)
+extern __inline__ long long __cdecl atoll (const char * _c)
{ return _atoi64 (_c); }
-extern __inline__ char* lltoa(long long _n, char * _c, int _i)
+extern __inline__ char* __cdecl lltoa (long long _n, char * _c, int _i)
{ return _i64toa (_n, _c, _i); }
-extern __inline__ char* ulltoa(unsigned long long _n, char * _c, int _i)
+extern __inline__ char* __cdecl ulltoa (unsigned long long _n, char * _c, int _i)
{ return _ui64toa (_n, _c, _i); }
-extern __inline__ long long wtoll(const wchar_t * _w)
+extern __inline__ long long __cdecl wtoll (const wchar_t * _w)
{ return _wtoi64 (_w); }
-extern __inline__ wchar_t* lltow(long long _n, wchar_t * _w, int _i)
+extern __inline__ wchar_t* __cdecl lltow (long long _n, wchar_t * _w, int _i)
{ return _i64tow (_n, _w, _i); }
-extern __inline__ wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
+extern __inline__ wchar_t* __cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i)
{ return _ui64tow (_n, _w, _i); }
#endif /* (__STRICT_ANSI__) */
diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h
index 7647c29c8..9f6b2bfbf 100644
--- a/winsup/mingw/include/string.h
+++ b/winsup/mingw/include/string.h
@@ -49,52 +49,52 @@ extern "C" {
/*
* Prototypes of the ANSI Standard C library string functions.
*/
-void* memchr (const void*, int, size_t);
-int memcmp (const void*, const void*, size_t);
-void* memcpy (void*, const void*, size_t);
-void* memmove (void*, const void*, size_t);
-void* memset (void*, int, size_t);
-char* strcat (char*, const char*);
-char* strchr (const char*, int);
-int strcmp (const char*, const char*);
-int strcoll (const char*, const char*); /* Compare using locale */
-char* strcpy (char*, const char*);
-size_t strcspn (const char*, const char*);
-char* strerror (int); /* NOTE: NOT an old name wrapper. */
-
-size_t strlen (const char*);
-char* strncat (char*, const char*, size_t);
-int strncmp (const char*, const char*, size_t);
-char* strncpy (char*, const char*, size_t);
-char* strpbrk (const char*, const char*);
-char* strrchr (const char*, int);
-size_t strspn (const char*, const char*);
-char* strstr (const char*, const char*);
-char* strtok (char*, const char*);
-size_t strxfrm (char*, const char*, size_t);
+_CRTIMP void* __cdecl memchr (const void*, int, size_t);
+_CRTIMP int __cdecl memcmp (const void*, const void*, size_t);
+_CRTIMP void* __cdecl memcpy (void*, const void*, size_t);
+_CRTIMP void* __cdecl memmove (void*, const void*, size_t);
+_CRTIMP void* __cdecl memset (void*, int, size_t);
+_CRTIMP char* __cdecl strcat (char*, const char*);
+_CRTIMP char* __cdecl strchr (const char*, int);
+_CRTIMP int __cdecl strcmp (const char*, const char*);
+_CRTIMP int __cdecl strcoll (const char*, const char*); /* Compare using locale */
+_CRTIMP char* __cdecl strcpy (char*, const char*);
+_CRTIMP size_t __cdecl strcspn (const char*, const char*);
+_CRTIMP char* __cdecl strerror (int); /* NOTE: NOT an old name wrapper. */
+
+_CRTIMP size_t __cdecl strlen (const char*);
+_CRTIMP char* __cdecl strncat (char*, const char*, size_t);
+_CRTIMP int __cdecl strncmp (const char*, const char*, size_t);
+_CRTIMP char* __cdecl strncpy (char*, const char*, size_t);
+_CRTIMP char* __cdecl strpbrk (const char*, const char*);
+_CRTIMP char* __cdecl strrchr (const char*, int);
+_CRTIMP size_t __cdecl strspn (const char*, const char*);
+_CRTIMP char* __cdecl strstr (const char*, const char*);
+_CRTIMP char* __cdecl strtok (char*, const char*);
+_CRTIMP size_t __cdecl strxfrm (char*, const char*, size_t);
#ifndef __STRICT_ANSI__
/*
* Extra non-ANSI functions provided by the CRTDLL library
*/
-char* _strerror (const char *);
-void* _memccpy (void*, const void*, int, size_t);
-int _memicmp (const void*, const void*, size_t);
-char* _strdup (const char*);
-int _strcmpi (const char*, const char*);
-int _stricmp (const char*, const char*);
-int _stricoll (const char*, const char*);
-char* _strlwr (char*);
-int _strnicmp (const char*, const char*, size_t);
-char* _strnset (char*, int, size_t);
-char* _strrev (char*);
-char* _strset (char*, int);
-char* _strupr (char*);
-void _swab (const char*, char*, size_t);
+_CRTIMP char* __cdecl _strerror (const char *);
+_CRTIMP void* __cdecl _memccpy (void*, const void*, int, size_t);
+_CRTIMP int __cdecl _memicmp (const void*, const void*, size_t);
+_CRTIMP char* __cdecl _strdup (const char*);
+_CRTIMP int __cdecl _strcmpi (const char*, const char*);
+_CRTIMP int __cdecl _stricmp (const char*, const char*);
+_CRTIMP int __cdecl _stricoll (const char*, const char*);
+_CRTIMP char* __cdecl _strlwr (char*);
+_CRTIMP int __cdecl _strnicmp (const char*, const char*, size_t);
+_CRTIMP char* __cdecl _strnset (char*, int, size_t);
+_CRTIMP char* __cdecl _strrev (char*);
+_CRTIMP char* __cdecl _strset (char*, int);
+_CRTIMP char* __cdecl _strupr (char*);
+_CRTIMP void __cdecl _swab (const char*, char*, size_t);
#ifdef __MSVCRT__
-int _strncoll(const char*, const char*, size_t);
-int _strnicoll(const char*, const char*, size_t);
+_CRTIMP int __cdecl _strncoll(const char*, const char*, size_t);
+_CRTIMP int __cdecl _strnicoll(const char*, const char*, size_t);
#endif
#endif /* Not __STRICT_ANSI__ */
@@ -102,23 +102,23 @@ int _strnicoll(const char*, const char*, size_t);
/*
* Unicode versions of the standard calls.
*/
-wchar_t* wcscat (wchar_t*, const wchar_t*);
-wchar_t* wcschr (const wchar_t*, wchar_t);
-int wcscmp (const wchar_t*, const wchar_t*);
-int wcscoll (const wchar_t*, const wchar_t*);
-wchar_t* wcscpy (wchar_t*, const wchar_t*);
-size_t wcscspn (const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcscat (wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcschr (const wchar_t*, wchar_t);
+_CRTIMP int __cdecl wcscmp (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl wcscoll (const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcscpy (wchar_t*, const wchar_t*);
+_CRTIMP size_t __cdecl wcscspn (const wchar_t*, const wchar_t*);
/* Note: No wcserror in CRTDLL. */
-size_t wcslen (const wchar_t*);
-wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
-int wcsncmp(const wchar_t*, const wchar_t*, size_t);
-wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
-wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
-wchar_t* wcsrchr(const wchar_t*, wchar_t);
-size_t wcsspn(const wchar_t*, const wchar_t*);
-wchar_t* wcsstr(const wchar_t*, const wchar_t*);
-wchar_t* wcstok(wchar_t*, const wchar_t*);
-size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
+_CRTIMP size_t __cdecl wcslen (const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcsncat (wchar_t*, const wchar_t*, size_t);
+_CRTIMP int __cdecl wcsncmp(const wchar_t*, const wchar_t*, size_t);
+_CRTIMP wchar_t* __cdecl wcsncpy(wchar_t*, const wchar_t*, size_t);
+_CRTIMP wchar_t* __cdecl wcspbrk(const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcsrchr(const wchar_t*, wchar_t);
+_CRTIMP size_t __cdecl wcsspn(const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcsstr(const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcstok(wchar_t*, const wchar_t*);
+_CRTIMP size_t __cdecl wcsxfrm(wchar_t*, const wchar_t*, size_t);
#ifndef __STRICT_ANSI__
/*
@@ -128,19 +128,19 @@ size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
#define _wcscmpi _wcsicmp
-wchar_t* _wcsdup (const wchar_t*);
-int _wcsicmp (const wchar_t*, const wchar_t*);
-int _wcsicoll (const wchar_t*, const wchar_t*);
-wchar_t* _wcslwr (wchar_t*);
-int _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
-wchar_t* _wcsnset (wchar_t*, wchar_t, size_t);
-wchar_t* _wcsrev (wchar_t*);
-wchar_t* _wcsset (wchar_t*, wchar_t);
-wchar_t* _wcsupr (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wcsdup (const wchar_t*);
+_CRTIMP int __cdecl _wcsicmp (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl _wcsicoll (const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl _wcslwr (wchar_t*);
+_CRTIMP int __cdecl _wcsnicmp (const wchar_t*, const wchar_t*, size_t);
+_CRTIMP wchar_t* __cdecl _wcsnset (wchar_t*, wchar_t, size_t);
+_CRTIMP wchar_t* __cdecl _wcsrev (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wcsset (wchar_t*, wchar_t);
+_CRTIMP wchar_t* __cdecl _wcsupr (wchar_t*);
#ifdef __MSVCRT__
-int _wcsncoll(const wchar_t*, const wchar_t*, size_t);
-int _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
+_CRTIMP int __cdecl _wcsncoll(const wchar_t*, const wchar_t*, size_t);
+_CRTIMP int __cdecl _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
#endif
@@ -156,41 +156,41 @@ int _wcsnicoll(const wchar_t*, const wchar_t*, size_t);
* strcasecmp.
*/
-void* memccpy (void*, const void*, int, size_t);
-int memicmp (const void*, const void*, size_t);
-char* strdup (const char*);
-int strcmpi (const char*, const char*);
-int stricmp (const char*, const char*);
-extern __inline__ int
+_CRTIMP void* __cdecl memccpy (void*, const void*, int, size_t);
+_CRTIMP int __cdecl memicmp (const void*, const void*, size_t);
+_CRTIMP char* __cdecl strdup (const char*);
+_CRTIMP int __cdecl strcmpi (const char*, const char*);
+_CRTIMP int __cdecl stricmp (const char*, const char*);
+extern __inline__ int __cdecl
strcasecmp (const char * __sz1, const char * __sz2)
{return _stricmp (__sz1, __sz2);}
-int stricoll (const char*, const char*);
-char* strlwr (char*);
-int strnicmp (const char*, const char*, size_t);
-extern __inline__ int
+_CRTIMP int __cdecl stricoll (const char*, const char*);
+_CRTIMP char* __cdecl strlwr (char*);
+_CRTIMP int __cdecl strnicmp (const char*, const char*, size_t);
+extern __inline__ int __cdecl
strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare)
{return _strnicmp (__sz1, __sz2, __sizeMaxCompare);}
-char* strnset (char*, int, size_t);
-char* strrev (char*);
-char* strset (char*, int);
-char* strupr (char*);
+_CRTIMP char* __cdecl strnset (char*, int, size_t);
+_CRTIMP char* __cdecl strrev (char*);
+_CRTIMP char* __cdecl strset (char*, int);
+_CRTIMP char* __cdecl strupr (char*);
#ifndef _UWIN
-void swab (const char*, char*, size_t);
+_CRTIMP void __cdecl swab (const char*, char*, size_t);
#endif /* _UWIN */
/* NOTE: There is no _wcscmpi, but this is for compatibility. */
-extern __inline__ int
+extern __inline__ int __cdecl
wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2)
{return _wcsicmp (__ws1, __ws2);}
-wchar_t* wcsdup (wchar_t*);
-int wcsicmp (const wchar_t*, const wchar_t*);
-int wcsicoll (const wchar_t*, const wchar_t*);
-wchar_t* wcslwr (wchar_t*);
-int wcsnicmp (const wchar_t*, const wchar_t*, size_t);
-wchar_t* wcsnset (wchar_t*, wchar_t, size_t);
-wchar_t* wcsrev (wchar_t*);
-wchar_t* wcsset (wchar_t*, wchar_t);
-wchar_t* wcsupr (wchar_t*);
+_CRTIMP wchar_t* __cdecl wcsdup (wchar_t*);
+_CRTIMP int __cdecl wcsicmp (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl wcsicoll (const wchar_t*, const wchar_t*);
+_CRTIMP wchar_t* __cdecl wcslwr (wchar_t*);
+_CRTIMP int __cdecl wcsnicmp (const wchar_t*, const wchar_t*, size_t);
+_CRTIMP wchar_t* __cdecl wcsnset (wchar_t*, wchar_t, size_t);
+_CRTIMP wchar_t* __cdecl wcsrev (wchar_t*);
+_CRTIMP wchar_t* __cdecl wcsset (wchar_t*, wchar_t);
+_CRTIMP wchar_t* __cdecl wcsupr (wchar_t*);
#endif /* Not _NO_OLDNAMES */
#endif /* Not strict ANSI */
diff --git a/winsup/mingw/include/sys/stat.h b/winsup/mingw/include/sys/stat.h
index 1620b0684..f851c25f4 100644
--- a/winsup/mingw/include/sys/stat.h
+++ b/winsup/mingw/include/sys/stat.h
@@ -154,16 +154,16 @@ struct _stati64 {
extern "C" {
#endif
-int _fstat (int, struct _stat*);
-int _chmod (const char*, int);
-int _stat (const char*, struct _stat*);
+_CRTIMP int __cdecl _fstat (int, struct _stat*);
+_CRTIMP int __cdecl _chmod (const char*, int);
+_CRTIMP int __cdecl _stat (const char*, struct _stat*);
#if defined (__MSVCRT__)
-int _fstati64(int, struct _stati64 *);
-int _stati64(const char *, struct _stati64 *);
+_CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
+_CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */
-int _wstat(const wchar_t*, struct _stat*);
-int _wstati64 (const wchar_t*, struct _stati64*);
+_CRTIMP int __cdecl _wstat(const wchar_t*, struct _stat*);
+_CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*);
#define _WSTAT_DEFINED
#endif /* _WSTAT_DEFIND */
#endif /* __MSVCRT__ */
@@ -171,9 +171,9 @@ int _wstati64 (const wchar_t*, struct _stati64*);
#ifndef _NO_OLDNAMES
/* These functions live in liboldnames.a. */
-int fstat (int, struct stat*);
-int chmod (const char*, int);
-int stat (const char*, struct stat*);
+_CRTIMP int __cdecl fstat (int, struct stat*);
+_CRTIMP int __cdecl chmod (const char*, int);
+_CRTIMP int __cdecl stat (const char*, struct stat*);
#endif /* Not _NO_OLDNAMES */
diff --git a/winsup/mingw/include/sys/timeb.h b/winsup/mingw/include/sys/timeb.h
index 201116275..16b4dc0a4 100644
--- a/winsup/mingw/include/sys/timeb.h
+++ b/winsup/mingw/include/sys/timeb.h
@@ -64,10 +64,10 @@ extern "C" {
#endif
/* TODO: Not tested. */
-void _ftime (struct _timeb*);
+_CRTIMP void __cdecl _ftime (struct _timeb*);
#ifndef _NO_OLDNAMES
-void ftime (struct timeb*);
+_CRTIMP void __cdecl ftime (struct timeb*);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
diff --git a/winsup/mingw/include/sys/utime.h b/winsup/mingw/include/sys/utime.h
index 7c907f32a..1ddeabafa 100644
--- a/winsup/mingw/include/sys/utime.h
+++ b/winsup/mingw/include/sys/utime.h
@@ -65,16 +65,16 @@ struct utimbuf
extern "C" {
#endif
-int _utime (const char*, struct _utimbuf*);
-int _futime (int, struct _utimbuf*);
+_CRTIMP int __cdecl _utime (const char*, struct _utimbuf*);
+_CRTIMP int __cdecl _futime (int, struct _utimbuf*);
/* The wide character version, only available for MSVCRT versions of the
* C runtime library. */
#ifdef __MSVCRT__
-int _wutime (const wchar_t*, struct _utimbuf*);
+_CRTIMP int __cdecl _wutime (const wchar_t*, struct _utimbuf*);
#endif /* MSVCRT runtime */
#ifndef _NO_OLDNAMES
-int utime (const char*, struct utimbuf*);
+_CRTIMP int __cdecl utime (const char*, struct utimbuf*);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
diff --git a/winsup/mingw/include/time.h b/winsup/mingw/include/time.h
index 6d15c2f89..0b8ef01f3 100644
--- a/winsup/mingw/include/time.h
+++ b/winsup/mingw/include/time.h
@@ -93,10 +93,10 @@ struct tm
extern "C" {
#endif
-clock_t clock (void);
-time_t time (time_t*);
-double difftime (time_t, time_t);
-time_t mktime (struct tm*);
+_CRTIMP clock_t __cdecl clock (void);
+_CRTIMP time_t __cdecl time (time_t*);
+_CRTIMP double __cdecl difftime (time_t, time_t);
+_CRTIMP time_t __cdecl mktime (struct tm*);
/*
* These functions write to and return pointers to static buffers that may
@@ -108,26 +108,26 @@ time_t mktime (struct tm*);
* Fault and crap out your program. Guess how I know. Hint: stat called on
* a directory gives 'invalid' times in st_atime etc...
*/
-char* asctime (const struct tm*);
-char* ctime (const time_t*);
-struct tm* gmtime (const time_t*);
-struct tm* localtime (const time_t*);
+_CRTIMP char* __cdecl asctime (const struct tm*);
+_CRTIMP char* __cdecl ctime (const time_t*);
+_CRTIMP struct tm* __cdecl gmtime (const time_t*);
+_CRTIMP struct tm* __cdecl localtime (const time_t*);
-size_t strftime (char*, size_t, const char*, const struct tm*);
+_CRTIMP size_t __cdecl strftime (char*, size_t, const char*, const struct tm*);
-size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
+_CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
#ifndef __STRICT_ANSI__
-extern void _tzset (void);
+extern _CRTIMP void __cdecl _tzset (void);
#ifndef _NO_OLDNAMES
-extern void tzset (void);
+extern _CRTIMP void __cdecl tzset (void);
#endif
-size_t strftime(char*, size_t, const char*, const struct tm*);
-char* _strdate(char*);
-char* _strtime(char*);
+_CRTIMP size_t __cdecl strftime(char*, size_t, const char*, const struct tm*);
+_CRTIMP char* __cdecl _strdate(char*);
+_CRTIMP char* __cdecl _strtime(char*);
#endif /* Not __STRICT_ANSI__ */
@@ -140,9 +140,9 @@ char* _strtime(char*);
#ifdef __MSVCRT__
/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */
-extern int* __p__daylight (void);
-extern long* __p__timezone (void);
-extern char** __p__tzname (void);
+extern _CRTIMP int* __cdecl __p__daylight (void);
+extern _CRTIMP long* __cdecl __p__timezone (void);
+extern _CRTIMP char** __cdecl __p__tzname (void);
__MINGW_IMPORT int _daylight;
__MINGW_IMPORT long _timezone;
@@ -186,10 +186,10 @@ __MINGW_IMPORT char *tzname[2];
/* wide function prototypes, also declared in wchar.h */
-wchar_t * _wasctime(const struct tm*);
-wchar_t * _wctime(const time_t*);
-wchar_t* _wstrdate(wchar_t*);
-wchar_t* _wstrtime(wchar_t*);
+_CRTIMP wchar_t* __cdecl _wasctime(const struct tm*);
+_CRTIMP wchar_t* __cdecl _wctime(const time_t*);
+_CRTIMP wchar_t* __cdecl _wstrdate(wchar_t*);
+_CRTIMP wchar_t* __cdecl _wstrtime(wchar_t*);
#define _WTIME_DEFINED
#endif /* _WTIME_DEFINED */
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
index 3c3fa2931..90bb82726 100644
--- a/winsup/mingw/include/wchar.h
+++ b/winsup/mingw/include/wchar.h
@@ -85,65 +85,65 @@ struct _wfinddatai64_t {
applies to other wide character versions? */
#if !defined (_WIO_DEFINED)
#if defined (__MSVCRT__)
-int _waccess (const wchar_t*, int);
-int _wchmod (const wchar_t*, int);
-int _wcreat (const wchar_t*, int);
-long _wfindfirst (const wchar_t*, struct _wfinddata_t *);
-int _wfindnext (long, struct _wfinddata_t *);
-int _wunlink (const wchar_t*);
-int _wopen (const wchar_t*, int, ...);
-int _wsopen (const wchar_t*, int, int, ...);
-wchar_t* _wmktemp (wchar_t*);
-long _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
-int _wfindnexti64 (long, struct _wfinddatai64_t*);
+_CRTIMP int __cdecl _waccess (const wchar_t*, int);
+_CRTIMP int __cdecl _wchmod (const wchar_t*, int);
+_CRTIMP int __cdecl _wcreat (const wchar_t*, int);
+_CRTIMP long __cdecl _wfindfirst (const wchar_t*, struct _wfinddata_t *);
+_CRTIMP int __cdecl _wfindnext (long, struct _wfinddata_t *);
+_CRTIMP int __cdecl _wunlink (const wchar_t*);
+_CRTIMP int __cdecl _wopen (const wchar_t*, int, ...);
+_CRTIMP int __cdecl _wsopen (const wchar_t*, int, int, ...);
+_CRTIMP wchar_t* __cdecl _wmktemp (wchar_t*);
+_CRTIMP long __cdecl _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*);
+_CRTIMP int __cdecl _wfindnexti64 (long, struct _wfinddatai64_t*);
#endif /* defined (__MSVCRT__) */
#define _WIO_DEFINED
#endif /* _WIO_DEFINED */
#ifndef _WSTDIO_DEFINED
/* also in stdio.h - keep in sync */
-int fwprintf (FILE*, const wchar_t*, ...);
-int wprintf (const wchar_t*, ...);
-int swprintf (wchar_t*, const wchar_t*, ...);
-int _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
-int vfwprintf (FILE*, const wchar_t*, va_list);
-int vwprintf (const wchar_t*, va_list);
-int vswprintf (wchar_t*, const wchar_t*, va_list);
-int _vsnwprintf (wchar_t*, size_t, const wchar_t*, va_list);
-int fwscanf (FILE*, const wchar_t*, ...);
-int wscanf (const wchar_t*, ...);
-int swscanf (const wchar_t*, const wchar_t*, ...);
-wint_t fgetwc (FILE*);
-wint_t fputwc (wchar_t, FILE*);
-wint_t ungetwc (wchar_t, FILE*);
+_CRTIMP int __cdecl fwprintf (FILE*, const wchar_t*, ...);
+_CRTIMP int __cdecl wprintf (const wchar_t*, ...);
+_CRTIMP int __cdecl swprintf (wchar_t*, const wchar_t*, ...);
+_CRTIMP int __cdecl _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
+_CRTIMP int __cdecl vfwprintf (FILE*, const wchar_t*, __VA_LIST);
+_CRTIMP int __cdecl vwprintf (const wchar_t*, __VA_LIST);
+_CRTIMP int __cdecl vswprintf (wchar_t*, const wchar_t*, __VA_LIST);
+_CRTIMP int __cdecl _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VA_LIST);
+_CRTIMP int __cdecl fwscanf (FILE*, const wchar_t*, ...);
+_CRTIMP int __cdecl wscanf (const wchar_t*, ...);
+_CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
+_CRTIMP wint_t __cdecl fgetwc (FILE*);
+_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
+_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
-extern __inline__ int vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
- va_list arg)
+int __cdecl snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
+extern __inline__ int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
+ __VA_LIST arg)
{ return _vsnwprintf ( s, n, format, arg); }
#endif
#ifdef __MSVCRT__
-wchar_t* fgetws (wchar_t*, int, FILE*);
-int fputws (const wchar_t*, FILE*);
-wint_t getwc (FILE*);
-wint_t getwchar (void);
-wchar_t* _getws (wchar_t*);
-wint_t putwc (wint_t, FILE*);
-int _putws (const wchar_t*);
-wint_t putwchar (wint_t);
-FILE* _wfdopen(int, wchar_t *);
-FILE* _wfopen (const wchar_t*, const wchar_t*);
-FILE* _wfreopen (const wchar_t*, const wchar_t*, FILE*);
-FILE* _wfsopen (const wchar_t*, const wchar_t*, int);
-wchar_t* _wtmpnam (wchar_t*);
-wchar_t* _wtempnam (const wchar_t*, const wchar_t*);
-int _wrename (const wchar_t*, const wchar_t*);
-int _wremove (const wchar_t*)
-
-FILE* _wpopen (const wchar_t*, const wchar_t*)
-void _wperror (const wchar_t*);
+_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
+_CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
+_CRTIMP wint_t __cdecl getwc (FILE*);
+_CRTIMP wint_t __cdecl getwchar (void);
+_CRTIMP wchar_t* __cdecl _getws (wchar_t*);
+_CRTIMP wint_t __cdecl putwc (wint_t, FILE*);
+_CRTIMP int __cdecl _putws (const wchar_t*);
+_CRTIMP wint_t __cdecl putwchar (wint_t);
+_CRTIMP FILE* __cdecl _wfdopen(int, wchar_t *);
+_CRTIMP FILE* __cdecl _wfopen (const wchar_t*, const wchar_t*);
+_CRTIMP FILE* __cdecl _wfreopen (const wchar_t*, const wchar_t*, FILE*);
+_CRTIMP FILE* __cdecl _wfsopen (const wchar_t*, const wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _wtmpnam (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wtempnam (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl _wrename (const wchar_t*, const wchar_t*);
+_CRTIMP int __cdecl _wremove (const wchar_t*)
+
+_CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*)
+_CRTIMP void __cdecl _wperror (const wchar_t*);
#endif /* __MSVCRT__ */
#define _WSTDIO_DEFINED
#endif /* _WSTDIO_DEFINED */
@@ -151,11 +151,11 @@ void _wperror (const wchar_t*);
#ifndef _WDIRECT_DEFINED
/* Also in direct.h */
#ifdef __MSVCRT__
-int _wchdir (const wchar_t*);
-wchar_t* _wgetcwd (wchar_t*, int);
-wchar_t* _wgetdcwd (int, wchar_t*, int);
-int _wmkdir (const wchar_t*);
-int _wrmdir (const wchar_t*);
+_CRTIMP int __cdecl _wchdir (const wchar_t*);
+_CRTIMP wchar_t* __cdecl _wgetcwd (wchar_t*, int);
+_CRTIMP wchar_t* __cdecl _wgetdcwd (int, wchar_t*, int);
+_CRTIMP int __cdecl _wmkdir (const wchar_t*);
+_CRTIMP int __cdecl _wrmdir (const wchar_t*);
#endif /* __MSVCRT__ */
#define _WDIRECT_DEFINED
#endif /* _WDIRECT_DEFINED */
@@ -220,8 +220,8 @@ struct _stati64 {
#if !defined ( _WSTAT_DEFINED)
/* also declared in sys/stat.h */
#if defined __MSVCRT__
-int _wstat (const wchar_t*, struct _stat*);
-int _wstati64 (const wchar_t*, struct _stati64*);
+_CRTIMP int __cdecl _wstat (const wchar_t*, struct _stat*);
+_CRTIMP int __cdecl _wstati64 (const wchar_t*, struct _stati64*);
#endif /* __MSVCRT__ */
#define _WSTAT_DEFINED
#endif /* ! _WSTAT_DEFIND */
@@ -229,28 +229,28 @@ int _wstati64 (const wchar_t*, struct _stati64*);
#ifndef _WTIME_DEFINED
#ifdef __MSVCRT__
/* wide function prototypes, also declared in time.h */
-wchar_t* _wasctime (const struct tm*);
-wchar_t* _wctime (const time_t*);
-wchar_t* _wstrdate (wchar_t*);
-wchar_t* _wstrtime (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wasctime (const struct tm*);
+_CRTIMP wchar_t* __cdecl _wctime (const time_t*);
+_CRTIMP wchar_t* __cdecl _wstrdate (wchar_t*);
+_CRTIMP wchar_t* __cdecl _wstrtime (wchar_t*);
#endif /* __MSVCRT__ */
-size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
+_CRTIMP size_t __cdecl wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
#define _WTIME_DEFINED
#endif /* _WTIME_DEFINED */
#ifndef _WLOCALE_DEFINED /* also declared in locale.h */
-wchar_t* _wsetlocale (int, const wchar_t*);
+_CRTIMP wchar_t* __cdecl _wsetlocale (int, const wchar_t*);
#define _WLOCALE_DEFINED
#endif
#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */
-long wcstol (const wchar_t*, wchar_t**, int);
-unsigned long wcstoul (const wchar_t*, wchar_t**, int);
-double wcstod (const wchar_t*, wchar_t**);
+_CRTIMP long __cdecl wcstol (const wchar_t*, wchar_t**, int);
+_CRTIMP unsigned long __cdecl wcstoul (const wchar_t*, wchar_t**, int);
+_CRTIMP double __cdecl wcstod (const wchar_t*, wchar_t**);
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-extern __inline__ float wcstof( const wchar_t *nptr, wchar_t **endptr)
+extern __inline__ float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr)
{ return (wcstod(nptr, endptr)); }
-long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
+long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
#endif /* __NO_ISOCEXT */
#define _WSTDLIB_DEFINED
#endif
@@ -261,17 +261,17 @@ long double wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
/* Wide character versions. Also declared in io.h. */
/* CHECK: Are these in the oldnames??? NO! */
#if (0)
-int waccess (const wchar_t *, int);
-int wchmod (const wchar_t *, int);
-int wcreat (const wchar_t *, int);
-long wfindfirst (wchar_t *, struct _wfinddata_t *);
-int wfindnext (long, struct _wfinddata_t *);
-int wunlink (const wchar_t *);
-int wrename (const wchar_t *, const wchar_t *);
-int wremove (const wchar_t *);
-int wopen (const wchar_t *, int, ...);
-int wsopen (const wchar_t *, int, int, ...);
-wchar_t* wmktemp (wchar_t *);
+int waccess (const wchar_t *, int);
+int wchmod (const wchar_t *, int);
+int wcreat (const wchar_t *, int);
+long wfindfirst (wchar_t *, struct _wfinddata_t *);
+int wfindnext (long, struct _wfinddata_t *);
+int wunlink (const wchar_t *);
+int wrename (const wchar_t *, const wchar_t *);
+int wremove (const wchar_t *);
+int wopen (const wchar_t *, int, ...);
+int wsopen (const wchar_t *, int, int, ...);
+wchar_t* wmktemp (wchar_t *);
#endif
#endif /* _NO_OLDNAMES */
@@ -283,29 +283,28 @@ wchar_t* wmktemp (wchar_t *);
typedef int mbstate_t;
typedef wchar_t _Wint_t;
-wint_t btowc(int);
-size_t mbrlen(const char *, size_t, mbstate_t *);
-size_t mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
-size_t mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
+wint_t __cdecl btowc(int);
+size_t __cdecl mbrlen(const char *, size_t, mbstate_t *);
+size_t __cdecl mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
+size_t __cdecl mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
-size_t wcrtomb(char *, wchar_t, mbstate_t *);
-size_t wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
-int wctob(wint_t);
+size_t __cdecl wcrtomb(char *, wchar_t, mbstate_t *);
+size_t __cdecl wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
+int __cdecl wctob(wint_t);
#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */
-extern __inline__ int fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */
-extern __inline__ int mbsinit(const mbstate_t* ps) {return 1;}
-wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
-wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+extern __inline__ int __cdecl fwide(FILE* stream, int mode) {return -1;} /* limited to byte orientation */
+extern __inline__ int __cdecl mbsinit(const mbstate_t* ps) {return 1;}
+wchar_t* __cdecl wmemset(wchar_t* s, wchar_t c, size_t n);
+wchar_t* __cdecl wmemchr(const wchar_t* s, wchar_t c, size_t n);
int wmemcmp(const wchar_t* s1, const wchar_t * s2, size_t n);
-wchar_t* wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
+wchar_t* __cdecl wmemcpy(wchar_t* __restrict__ s1, const wchar_t* __restrict__ s2,
size_t n);
-wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
-long long wcstoll(const wchar_t* __restrict__ nptr,
+wchar_t* __cdecl wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
+long long __cdecl wcstoll(const wchar_t* __restrict__ nptr,
wchar_t** __restrict__ endptr, int base);
-unsigned long long wcstoull(const wchar_t* __restrict__ nptr,
+unsigned long long __cdecl wcstoull(const wchar_t* __restrict__ nptr,
wchar_t ** __restrict__ endptr, int base);
-
#endif /* __NO_ISOCEXT */
diff --git a/winsup/mingw/include/wctype.h b/winsup/mingw/include/wctype.h
index 858981b69..2f7a62e1c 100644
--- a/winsup/mingw/include/wctype.h
+++ b/winsup/mingw/include/wctype.h
@@ -64,25 +64,25 @@ typedef wchar_t wctype_t;
#endif
/* Wide character equivalents - also in ctype.h */
-int iswalnum(wint_t);
-int iswalpha(wint_t);
-int iswascii(wint_t);
-int iswcntrl(wint_t);
-int iswctype(wint_t, wctype_t);
-int is_wctype(wint_t, wctype_t); /* Obsolete! */
-int iswdigit(wint_t);
-int iswgraph(wint_t);
-int iswlower(wint_t);
-int iswprint(wint_t);
-int iswpunct(wint_t);
-int iswspace(wint_t);
-int iswupper(wint_t);
-int iswxdigit(wint_t);
-
-wchar_t towlower(wchar_t);
-wchar_t towupper(wchar_t);
-
-int isleadbyte (int);
+_CRTIMP int __cdecl iswalnum(wint_t);
+_CRTIMP int __cdecl iswalpha(wint_t);
+_CRTIMP int __cdecl iswascii(wint_t);
+_CRTIMP int __cdecl iswcntrl(wint_t);
+_CRTIMP int __cdecl iswctype(wint_t, wctype_t);
+_CRTIMP int __cdecl is_wctype(wint_t, wctype_t); /* Obsolete! */
+_CRTIMP int __cdecl iswdigit(wint_t);
+_CRTIMP int __cdecl iswgraph(wint_t);
+_CRTIMP int __cdecl iswlower(wint_t);
+_CRTIMP int __cdecl iswprint(wint_t);
+_CRTIMP int __cdecl iswpunct(wint_t);
+_CRTIMP int __cdecl iswspace(wint_t);
+_CRTIMP int __cdecl iswupper(wint_t);
+_CRTIMP int __cdecl iswxdigit(wint_t);
+
+_CRTIMP wchar_t __cdecl towlower(wchar_t);
+_CRTIMP wchar_t __cdecl towupper(wchar_t);
+
+_CRTIMP int __cdecl isleadbyte (int);
/* Also in ctype.h */
@@ -108,28 +108,29 @@ extern unsigned short** _imp___ctype;
#endif /* __DECLSPEC_SUPPORTED */
-#if !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED))
+#if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \
+ || defined(__WCTYPE_INLINES_DEFINED))
#define __WCTYPE_INLINES_DEFINED
-extern __inline__ int iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
-extern __inline__ int iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
-extern __inline__ int iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
-extern __inline__ int iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
-extern __inline__ int iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
-extern __inline__ int iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
-extern __inline__ int iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
-extern __inline__ int iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
-extern __inline__ int iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
-extern __inline__ int iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
-extern __inline__ int iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
-extern __inline__ int isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
+extern __inline__ int __cdecl iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));}
+extern __inline__ int __cdecl iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);}
+extern __inline__ int __cdecl iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));}
+extern __inline__ int __cdecl iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));}
+extern __inline__ int __cdecl iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswlower(wint_t wc) {return (iswctype(wc,_LOWER));}
+extern __inline__ int __cdecl iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));}
+extern __inline__ int __cdecl iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));}
+extern __inline__ int __cdecl iswspace(wint_t wc) {return (iswctype(wc,_SPACE));}
+extern __inline__ int __cdecl iswupper(wint_t wc) {return (iswctype(wc,_UPPER));}
+extern __inline__ int __cdecl iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));}
+extern __inline__ int __cdecl isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);}
#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */
typedef wchar_t wctrans_t;
-wint_t towctrans(wint_t, wctrans_t);
-wctrans_t wctrans(const char*);
-wctype_t wctype(const char*);
+_CRTIMP wint_t __cdecl towctrans(wint_t, wctrans_t);
+_CRTIMP wctrans_t __cdecl wctrans(const char*);
+_CRTIMP wctype_t __cdecl wctype(const char*);
#ifdef __cplusplus
}