Re: [PATCH:2] Export symbols when compiling a C runtime library
Danny Smith <[email protected]>
| Newsgroups | gmane.comp.gnu.mingw.patches |
|---|---|
| Message-ID | <001401c214ba$978d2f00$4591a7cb@DANNY> |
----- Original Message ----- From: "Casper Hornstrup" <[email protected]> To: <[email protected]> Sent: Saturday, 15 June 2002 23:48 Subject: [MinGW-patches] [PATCH:2] Export symbols when compiling a C runtime library > First version had wrong prototypes. This is now fixed. > Also some duplicate prototypes are removed. > > > Index: include/_mingw.h > =================================================================== > RCS file: /cvsroot/mingw/runtime/include/_mingw.h,v > retrieving revision 1.7 > diff -u -r1.7 _mingw.h > --- include/_mingw.h 14 Jun 2002 15:12:54 -0000 1.7 > +++ include/_mingw.h 15 Jun 2002 11:43:07 -0000 > @@ -44,9 +44,25 @@ > style declarations. */ > > #ifndef __GNUC__ > -# define __MINGW_IMPORT __declspec(dllimport) > -# define __DECLSPEC_SUPPORTED > -#else /* __GNUC__ */ > +# ifndef _CRT_ > +# define __MINGW_IMPORT __declspec(dllimport) > +# else /* _CRT_ */ > +# define __MINGW_IMPORT __declspec(dllexport) > +# endif /* _CRT_ */ > +# define __DECLSPEC_SUPPORTED > +#elif defined(_CRT_) /* __GNUC__ && _CRT_ */ > +# ifdef __declspec > + /* note the extern at the end. This is needed to work around GCC's > + limitations in handling dllexport attribute. */ > +# define __MINGW_IMPORT __attribute__((dllexport)) extern > +# define __DECLSPEC_SUPPORTED > +# else > +# undef __DECLSPEC_SUPPORTED > +# undef __MINGW_IMPORT > +# endif > +# undef __int64 > +# define __int64 long long > +#else /* __GNUC__ && !_CRT_ */ > # ifdef __declspec > /* Note the extern. This is needed to work around GCC's > limitations in handling dllimport attribute. */ > @@ -58,7 +74,7 @@ > # endif > # undef __int64 > # define __int64 long long > -#endif /* __GNUC__ */ > +#endif /* __GNUC__ && !_CRT_ */ I really don't like putting building _CRT_ stuff in user-land header. Why not just let command line defines override header: #ifndef __GNUC__ + # ifndef __MINGW_IMPORT # define __MINGW_IMPORT __declspec(dllimport) + # endif # define __DECLSPEC_SUPPORTED #else /* __GNUC__ */ # ifdef __declspec /* Note the extern. This is needed to work around GCC's limitations in handling dllimport attribute. */ + # ifndef __MINGW_IMPORT # define __MINGW_IMPORT extern __attribute__((dllimport)) + # endif + # define __DECLSPEC_SUPPORTED # else # undef __DECLSPEC_SUPPORTED - # undef __MINGW_IMPORT # endif + # ifndef __MINGW_IMPORT + # define __MINGW_IMPORT extern + # endif ==snip== > > Index: include/io.h > =================================================================== > RCS file: /cvsroot/mingw/runtime/include/io.h,v > retrieving revision 1.4 > diff -u -r1.4 io.h > --- include/io.h 29 Nov 2001 04:26:33 -0000 1.4 > +++ include/io.h 15 Jun 2002 11:43:07 -0000 > @@ -125,6 +125,7 @@ > int _mkdir (const char*); > char* _mktemp (char*); > int _rmdir (const char*); > +int _chmod (const char*, int); > This is also in sys/stat.h. Should we remove from sys/stat.h ?. ===snip== > Index: include/stdio.h > =================================================================== > RCS file: /cvsroot/mingw/runtime/include/stdio.h,v > retrieving revision 1.8 > diff -u -r1.8 stdio.h > --- include/stdio.h 14 Jun 2002 15:12:54 -0000 1.8 > +++ include/stdio.h 15 Jun 2002 11:43:07 -0000 > @@ -96,9 +96,16 @@ > */ > #define L_tmpnam (16) > > -#define _IOFBF 0x0000 > -#define _IOLBF 0x0040 > -#define _IONBF 0x0004 > +#define _IOFBF 0x0000 > +#define _IOLBF 0x0040 > +#define _IONBF 0x0004 > + > +#define _IOMYBUF 0x0008 > +#define _IOEOF 0x0010 > +#define _IOERR 0x0020 > +#define _IOSTRG 0x0040 > +#define _IORW 0x0080 > +#define _IOAPPEND 0x0200 > Can you document what these non-standard flags mean with some comments please.? > /* > * The buffer size as used by setbuf such that it is equivalent to > @@ -353,6 +360,8 @@ > wint_t putwc (wint_t, FILE*); > int _putws (const wchar_t*); > wint_t putwchar (wint_t); > +FILE* _fdopen(int, const char *); No. Already declared earlier in file. > +FILE* _wfdopen(int, wchar_t *); Also put in wchar.h. Unincode mappings in tchar.h. Thanks Danny > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink > > _______________________________________________ > MinGW-patches mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mingw-patches _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink