This is the mail archive of the gsl-discuss@sourceware.cygnus.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ support


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]