Re: apropos linking `dselect'
"MAD" == Michael Alan Dorman <mdorman@lot49.med.miami.edu> writes:
MAD> In message <[🔎] m0u0LMU-00000TC@songdog.eskimo.com>, roman@songdog.eskimo.com writes:
>>> I'm not sure how the _responsibility_ could rest on anything other
>>> than the C++ program, but it's common politeness for the C headers to
>>> take care of it.
>> I think you'll be hard-pressed to find an ANSI-standard C compiler that
>> accepts extern "C" { ... }. This syntax was added to C++ so that it could
>> interface with older languages that don't decorate their identifiers with
>> type information.
MAD> Most of the header files I've seen have done something like:
MAD> #ifdef __cplusplus
MAD> extern "C" {
MAD> #endif
MAD> ...
MAD> #ifdef __cplusplus
MAD> }
MAD> #endif
MAD> which is entirely likely to work with any ANSI C compiler that is not
MAD> so broken as to #define __cplusplus.
The `extern "C" { ... }' wrapper was invented to make it easy for
C++ programmers to use existing C headers, not the other way around.
If C++ wants to incorporate `/usr/include/blech.h', all it needs
to do is to create a corresponding C++ headers file `blech.hh' as
follows:
extern "C" {
include <blech.h>
}
-- <bhogan@rahul.net> --
"5. Improve constantly and forever the system of production and
service, to improve quality and productivity, and thus constantly
decrease costs." (W. Edwards Deming)
Reply to: