[345] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Re: __BEGIN_DECLS?

daemon@ATHENA.MIT.EDU (Chris G Demetriou)
Sat Jun 29 00:54:29 1996

To: stewart@global.co.za
Cc: pthreads@MIT.EDU
In-Reply-To: Your message of "Sat, 29 Jun 1996 01:13:21 -0000."
             <Pine.LNX.3.91.960629011035.653E-100000@quotient.global.co.za> 
Date: Sat, 29 Jun 1996 00:39:06 -0400
From: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>

> Could somebody please tell me what __BEGIN_DECLS and __END_DECLS do, and 
> where they are defined or what allows one to use them in headers?
> 
> (I realise that this isn't really a pthreads question, sorry)

in BSD systems (NetBSD, FreeBSD, BSD/OS, etc.) they are defined as:

#if defined(__cplusplus)
#define	__BEGIN_DECLS	extern "C" {
#define	__END_DECLS	};
#else
#define	__BEGIN_DECLS
#define	__END_DECLS
#endif

in <sys/cdefs.h>.

The notion is, "make the C prototypes (and/or functions; i don't know
anything about C++ prototyping and linkage) work in C++."


Really, since they begin with '_', however, they're in the
implementor's namespace, and other implementations may use them for
different things.  However, since at least some of the pthreads
headers have BSD ancestry, this is probably what you're looking for...
8-)


cgd

home help back first fref pref prev next nref lref last post