Subject: Re: Modifications of standard headers for PECOFF
To: TAMURA Kent <>
From: Jason R Thorpe <>
List: tech-userlevel
Date: 05/15/2002 23:34:57
On Thu, May 16, 2002 at 03:19:29PM +0900, TAMURA Kent wrote:

 > - Add /usr/include/sys/cdefs_pe.h
 > - Add LIBC_EXTERN definitions to cdefs_elf.h, cdefs_aout.h and cdefs_pe.h like:
 >    cdefs_elf.h cdefs_aout.h:
 > 	#define LIBC_EXTERN extern
 >    cdefs_pe.h:
 > 	#ifdef LIBC
 > 	#define LIBC_EXTERN __declspec(dllexport) extern
 > 	#else
 > 	#define LIBC_EXTERN __declspec(dllimport) extern
 > 	#endif
 > - Modify cdefs.h so that it includes cdefs_pe.h if __PECOFF__ is defined.
 > - For global variables defined in libc and exposed to the outside of libc,
 >   add LIBC_EXTERN to their declaration. For example,
 >    stdio.h:
 > 	extern FILE __sF[];
 > 	->

If these are going to be in header files, it must be in the implementation
namespace.  Might I suggest:

	__libc_extern FILE __sF[];

...or possibly:

	__lib_extern ...

because I guess libraries other than libc would need similar treatment?

Anyway, other than that, I don't see any reason not to allow these

 > The modifications are required because of the special treatment
 > for global variables exported/imported over DLLs. In the PEACE
 > project, we provide PECOFF versions of some standard libraries
 > such as libc.dll.  If the standard headers in /usr/include
 > supports PECOFF, we don't have to copy the headers and patch
 > them.
 > Any comments? might be nice to have to have the run-time linker in the
main source tree :-)

        -- Jason R. Thorpe <>