[PPL-devel] Supporting C and C++
Roberto Bagnara
bagnara at cs.unipr.it
Fri Jun 14 23:06:20 CEST 2002
Hi there,
in order to support both C and C++ compilers, it would be nice
to add a conditional `extern "C"' wrapper to c_interface.h.
While we are at it, we should probably also add the usual guard
against multiple inclusion.
The standard way to do that is as follows:
#ifndef _Yap_c_interface_h
#define _Yap_c_interface_h 1
/*
__BEGIN_DECLS should be used at the beginning of the C declarations,
so that C++ compilers don't mangle their names. __END_DECLS is used
at the end of C declarations.
*/
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
put current contents of c_interface.h here
__END_DECLS
#endif
All the best
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it
More information about the PPL-devel
mailing list