From 09ac85ba0a7b0fdfa52f460e24d86795fbb12032 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 25 Mar 2008 23:45:07 +0000 Subject: basic c++ compat git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@42 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce --- src/Makefile.am | 5 +++-- src/common.h | 2 +- src/macro.h | 10 ++++++++++ src/sydney.h | 14 +++++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index ad13181..a465b44 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. AM_CFLAGS = $(PTHREAD_CFLAGS) +AM_CXXFLAGS = $(PTHREAD_CFLAGS) AM_LIBADD = $(PTHREAD_LIBS) AM_LDADD = $(PTHREAD_LIBS) @@ -57,8 +58,8 @@ libsydney_la_SOURCES = \ libsydney_la_LIBADD = \ $(AM_LIBADD) \ $(LIBOIL_LIBS) -libsydney_la_CFLAGS = \ - $(AM_CFLAGS) \ +libsydney_la_CXXFLAGS = \ + $(AM_CXXFLAGS) \ $(LIBOIL_CFLAGS) \ -DRANDOM_PREFIX=saspeex -DOUTSIDE_SPEEX diff --git a/src/common.h b/src/common.h index 63fc991..9d01c44 100644 --- a/src/common.h +++ b/src/common.h @@ -53,7 +53,7 @@ struct sa_stream { sa_notify_t notify; sa_event_t event; - void *private; /* driver specific data */ + void *driver_data; /* driver specific data */ void *meta_data[_META_NAMES_MAX]; size_t meta_data_size[_META_NAMES_MAX]; diff --git a/src/macro.h b/src/macro.h index 4f2d018..30a7be4 100644 --- a/src/macro.h +++ b/src/macro.h @@ -105,4 +105,14 @@ typedef void (*sa_free_cb_t)(void *); typedef int sa_bool_t; +/* Guard C code in headers, while including them from C++ */ +#ifdef __cplusplus +# define SA_BEGIN_DECLS extern "C" { +# define SA_END_DECLS } +#else +# define SA_BEGIN_DECLS +# define SA_END_DECLS +#endif + + #endif diff --git a/src/sydney.h b/src/sydney.h index 00887f9..eb1a7ec 100644 --- a/src/sydney.h +++ b/src/sydney.h @@ -1,6 +1,10 @@ #ifndef foosydneyhfoo #define foosydneyhfoo +#ifdef __cplusplus +extern "C" { +#endif + /* Requirements: - In sync mode, the device will automatically write data so that an initial read causes writes @@ -88,7 +92,7 @@ typedef enum { SA_MODE_WRONLY = 1, SA_MODE_RDONLY = 2, SA_MODE_RDWR = 3, - _SA_MODE_MAX = 4, + _SA_MODE_MAX = 4 } sa_mode_t; /** Error codes */ @@ -205,7 +209,7 @@ typedef enum { SA_STATE_RUNNING, SA_STATE_STOPPED, /* put more stuff */ - _SA_STATE_MAX, + _SA_STATE_MAX } sa_state_t; typedef enum { @@ -217,7 +221,7 @@ typedef enum { typedef enum { SA_ADJUST_UP = 1, SA_ADJUST_DOWN = -1, - SA_ADJUST_NONE = 0, + SA_ADJUST_NONE = 0 } sa_adjust_t; /* Some kind of meta information. */ @@ -375,4 +379,8 @@ int sa_stream_drain(sa_stream_t *s); /** Return a human readable error */ const char *sa_strerror(int code); +#ifdef __cplusplus +} +#endif + #endif -- cgit