make internal header files more C++ friendly
Generally one doesn't need to include any internal header files in an application, but the (unstable) interface for application-defined sample representation and serialization does require including some. It turns out a keyword clash had to be resolved (typename => type_name) and that a whole bunch of them were missing the #ifdef __cplusplus / extern "C" bit. It further turned out that one had to pull in nearly all of the type definitions, including some typedefs that are illegal in C++, e.g., typedef struct os_sockWaitset *os_sockWaitset; C++ is right to forbid this, but Cyclone's header files were wrong to force inclusion of so much irrelevant stuff. This commit leaves these typedefs in place, but eliminates a few header file inclusions to avoid the problem. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
5f9aed1c87
commit
ae323ab0ca
56 changed files with 345 additions and 60 deletions
|
@ -12,6 +12,10 @@
|
|||
#ifndef DDSRT_ATOMICS_ARM_H
|
||||
#define DDSRT_ATOMICS_ARM_H
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(__arm__)
|
||||
#define __arm__
|
||||
#endif
|
||||
|
@ -209,5 +213,8 @@ inline void ddsrt_atomic_fence_rel (void) {
|
|||
ddsrt_atomic_fence ();
|
||||
}
|
||||
|
||||
#endif /* DDSRT_ATOMICS_ARM_H */
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_ATOMICS_ARM_H */
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
|
||||
#include "dds/ddsrt/misc.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if ( DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) || \
|
||||
(!DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
# define DDSRT_HAVE_ATOMIC_LIFO 1
|
||||
|
@ -287,5 +291,8 @@ inline void ddsrt_atomic_fence_rel (void) {
|
|||
ddsrt_atomic_fence ();
|
||||
}
|
||||
|
||||
#endif /* DDSRT_ATOMICS_GCC_H */
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_ATOMICS_GCC_H */
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
|
||||
#include "dds/ddsrt/misc.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* x86 has supported 64-bit CAS for a long time, so Windows ought to
|
||||
provide all the interlocked operations for 64-bit operands on x86
|
||||
platforms, but it doesn't. */
|
||||
|
@ -295,5 +299,8 @@ inline void ddsrt_atomic_fence_rel (void) {
|
|||
|
||||
#undef DDSRT_ATOMIC_PTROP
|
||||
|
||||
#endif /* DDSRT_ATOMICS_MSVC_H */
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_ATOMICS_MSVC_H */
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
*/
|
||||
#include <atomic.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DDSRT_ATOMIC64_SUPPORT 1
|
||||
|
||||
/* LD, ST */
|
||||
|
@ -239,3 +243,6 @@ inline void ddsrt_atomic_fence_rel (void) {
|
|||
membar_exit ();
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,10 +15,18 @@
|
|||
#include "dds/export.h"
|
||||
#include "dds/ddsrt/sync.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DDS_EXPORT void ddsrt_init(void);
|
||||
|
||||
DDS_EXPORT void ddsrt_fini(void);
|
||||
|
||||
DDS_EXPORT ddsrt_mutex_t *ddsrt_get_singleton_mutex(void);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_CDTORS_H */
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#define DDSRT_MD5_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "dds/export.h"
|
||||
|
||||
/*
|
||||
* This package supports both compile-time and run-time determination of CPU
|
||||
|
@ -90,13 +91,13 @@ extern "C"
|
|||
#endif
|
||||
|
||||
/* Initialize the algorithm. */
|
||||
void ddsrt_md5_init(ddsrt_md5_state_t *pms);
|
||||
DDS_EXPORT void ddsrt_md5_init(ddsrt_md5_state_t *pms);
|
||||
|
||||
/* Append a string to the message. */
|
||||
void ddsrt_md5_append(ddsrt_md5_state_t *pms, const ddsrt_md5_byte_t *data, unsigned nbytes);
|
||||
DDS_EXPORT void ddsrt_md5_append(ddsrt_md5_state_t *pms, const ddsrt_md5_byte_t *data, unsigned nbytes);
|
||||
|
||||
/* Finish the message and return the digest. */
|
||||
void ddsrt_md5_finish(ddsrt_md5_state_t *pms, ddsrt_md5_byte_t digest[16]);
|
||||
DDS_EXPORT void ddsrt_md5_finish(ddsrt_md5_state_t *pms, ddsrt_md5_byte_t digest[16]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
#include "dds/export.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int32_t dds_retcode_t;
|
||||
|
||||
/*
|
||||
|
@ -86,4 +90,8 @@ typedef int32_t dds_retcode_t;
|
|||
*/
|
||||
DDS_EXPORT const char *dds_strretcode(dds_retcode_t ret);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDS_RETCODE_H */
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#include "dds/ddsrt/time.h"
|
||||
#include "dds/ddsrt/retcode.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
dds_time_t utime; /* User CPU time used. */
|
||||
dds_time_t stime; /* System CPU time used. */
|
||||
|
@ -47,4 +51,8 @@ typedef struct {
|
|||
*/
|
||||
DDS_EXPORT dds_retcode_t ddsrt_getrusage(int who, ddsrt_rusage_t *usage);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_RUSAGE_H */
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "dds/ddsrt/sockets/posix.h"
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define INET_ADDRSTRLEN_EXTENDED (INET_ADDRSTRLEN + 6) /* ":12345" */
|
||||
|
||||
#if DDSRT_HAVE_IPV6
|
||||
|
@ -261,4 +265,8 @@ ddsrt_gethostbyname(
|
|||
ddsrt_hostent_t **hentp);
|
||||
#endif
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_SOCKETS_H */
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "dds/export.h"
|
||||
#include "dds/ddsrt/retcode.h"
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Convert a string to a double precision floating point number.
|
||||
*
|
||||
|
@ -72,4 +76,8 @@ ddsrt_dtostr(double src, char *str, size_t size);
|
|||
DDS_EXPORT int
|
||||
ddsrt_ftostr(float src, char *str, size_t size);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DDSRT_STRTOD_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue