Date: Fri, 7 Jul 2000 09:20:06 -0400 (EDT) From: Thomas David Rivers <rivers@dignus.com> To: gram@cequrux.com, king@sstar.com Cc: freebsd-stable@FreeBSD.ORG Subject: Re: Any chance of changing struct member names in nameser.h? Message-ID: <200007071320.JAA86645@lakes.dignus.com> In-Reply-To: <3ab0baefb12d7472b9def36580f56874@cequrux.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > > Actually, I was wronng - the nameser.h in contrib/bind is fine. But the > > > one in include/arpa/nameser.h is not, so this *is* specific to > > > FreeBSD/KAME... > > > > imho, the right way to handle this is in your source, using an 'extern "C"' > > directive to tell the compiler that it's including a C header and not a C++ > > header. e.g. > > > > extern "C" { > > #include <header_with_cpp_bogons.h> > > } > > > > If the #include directive is in another header file that might be used in > > both C and C++ programs you'd probably want to put some '#ifdef __cplusplus' > > around the extern's. See section 9.2.4 in Stroustrup 3rd edition for a good > > example. > > Great idea, except I thought of that long ago and it doesn't work. > > gram Nope - it wouldn't. extern "C" doesn't mean "The following source is C code" what it means is that any external linkage generated will use C linkage conventions. For most C++ implementations, this means "don't mangle function names". The source within an `extern "C"' block has to be parsable by the C++ parser... it's still C++. For example, you can't say: extern "PASCAL" { ... pascal source ... } and expect that to work... That's my understanding of how this works, anyway... - Dave R. - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe (370) `C' compiler at http://www.dignus.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007071320.JAA86645>