You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
klish/lub/c_decl.h

48 lines
814 B

/*
* c_decl.h
*
* a simple set of macros to ease declaration of C interfaces.
*/
/**
\ingroup lub
\defgroup lub_c_decl C linkage macros
@{
These two macros are used to simplify the declaration of C-linkage code.
Rather than worry about preprocessor directives similar to
\code
#ifdef __cplusplus
extern "C" {
#endif
int foobar(void);
#ifdef __cplusplus
}
#endif
\endcode
you simply need to use the _BEGIN_C_DECL and _END_C_DECL macros instead.
\code
#include "lub/c_decl.h"
_BEGIN_C_DECL
int foobar(void);
_END_C_DECL
\endcode
*/
#ifndef _lub_c_decl_h
#define _lub_c_decl_h
#ifdef __cplusplus
#define _BEGIN_C_DECL extern "C" {
#define _END_C_DECL }
#else /* not __cplusplus */
#define _BEGIN_C_DECL
#define _END_C_DECL
#endif /* not __cplusplus */
/** @} */
#endif /* _lub_c_decl_h */