C++ support

Dave Morrison dave@bnl.gov
Sat Jan 22 15:20:00 GMT 2000


Hi,

I haven't seen anything on this particular thread since late November,
so here are my $0.02.  I'm sure there are more elegant solutions out
there, but here's a straightforward prescription for adding the
requisite 'extern "C"' business in all the externally visible GSL header
files.  Once that's done, the header files should be usable "as is" from
a C++ user program.  I'm sure a quickie perl script could insert the
needed lines inside the usual inclusion protection #ifdefs.  That would
be even nicer.

% cd gsl
% cat > tmp.csh <<EOF
mv \$1 \$1.bak
echo '#ifdef __cplusplus\nextern "C" {\n#endif' > \$1
cat \$1.bak >> \$1
echo '#ifdef __cplusplus\n}\n#endif' >> \$1
EOF
% find . -name 'gsl_*.h' -exec /bin/csh ./tmp.csh {} \;

Cheers,
Dave
-- 
David Morrison  Brookhaven National Laboratory  phone: 631-344-5840
                Physics Department, Bldg 510 C    fax: 631-344-3253
		          Upton, NY 11973-5000  email: dave@bnl.gov


More information about the Gsl-discuss mailing list