1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix include problems when linking with C++

This commit is contained in:
Georg Reinke 2017-04-26 11:48:58 +02:00
parent 804f4abf9f
commit bb400b0e5c
4 changed files with 39 additions and 2 deletions

19
include/villas/atomic.h Normal file
View file

@ -0,0 +1,19 @@
/** Workaround for differently named atomic types in C/C++
*
* @file
* @author Georg Reinke <georg.reinke@rwth-aachen.de>
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
*********************************************************************************/
#ifdef __cplusplus
#include <atomic>
typedef std::atomic_int atomic_int;
typedef std::atomic_size_t atomic_size_t;
#else
#include <stdatomic.h>
#endif

View file

@ -33,11 +33,12 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
#include <unistd.h>
#include "atomic.h"
#include "common.h"
/* Forward declarations */

View file

@ -7,10 +7,15 @@
#pragma once
#include "atomic.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdatomic.h>
#include <time.h>
#include <sys/types.h>
@ -81,3 +86,7 @@ int sample_get_data_format(struct sample *s, int idx);
/** Set number representation for a single value of a sample. */
int sample_set_data_format(struct sample *s, int idx, enum sample_data_format fmt);
#ifdef __cplusplus
}
#endif

View file

@ -13,6 +13,10 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "pool.h"
#include "queue.h"
#include "queue_signalled.h"
@ -80,3 +84,7 @@ int shmem_shared_write(struct shmem_shared *shm, struct sample *smps[], unsigned
size_t shmem_total_size(int insize, int outsize, int sample_size);
/** @} */
#ifdef __cplusplus
}
#endif