diff --git a/src/endian.h b/src/endian.h index 46a76e4..f12b117 100644 --- a/src/endian.h +++ b/src/endian.h @@ -3,6 +3,8 @@ #include "global.h" +FOUG_C_LINKAGE_BEGIN + /*! This enum identifies endian representations of numbers */ enum foug_endianness { @@ -17,4 +19,6 @@ typedef enum foug_endianness foug_endianness_t; /*! Returns endianness (byte order) of the host's CPU architecture */ FOUG_LIB_EXPORT foug_endianness_t foug_host_endianness(); +FOUG_C_LINKAGE_END + #endif /* FOUG_ENDIAN_H */ diff --git a/src/error.h b/src/error.h index 3da10e8..66c6c17 100644 --- a/src/error.h +++ b/src/error.h @@ -3,6 +3,8 @@ #include "global.h" +FOUG_C_LINKAGE_BEGIN + /*! This enum defines common errors */ enum foug_datax_error { @@ -33,4 +35,6 @@ FOUG_LIB_EXPORT foug_bool_t foug_datax_no_error(int code); /*! Returns true if \p code != FOUG_DATAX_NO_ERROR */ FOUG_LIB_EXPORT foug_bool_t foug_datax_error(int code); +FOUG_C_LINKAGE_END + #endif /* FOUG_DATAX_C_ERROR_H */ diff --git a/src/global.h b/src/global.h index 00eb3ac..694eeac 100644 --- a/src/global.h +++ b/src/global.h @@ -73,4 +73,12 @@ typedef double foug_real64_t; # endif #endif /* !FOUG_INLINE */ +#ifdef __cplusplus +# define FOUG_C_LINKAGE_BEGIN extern "C" { +# define FOUG_C_LINKAGE_END } +#else +# define FOUG_C_LINKAGE_BEGIN +# define FOUG_C_LINKAGE_END +#endif /* __cplusplus */ + #endif /* FOUG_C_GLOBAL_H */ diff --git a/src/libstl/stl_format.h b/src/libstl/stl_format.h index 9ae1e43..b100f95 100644 --- a/src/libstl/stl_format.h +++ b/src/libstl/stl_format.h @@ -4,6 +4,8 @@ #include "stl_global.h" #include "../stream.h" +FOUG_C_LINKAGE_BEGIN + /*! This enums defines the various STL formats */ enum foug_stl_format { @@ -18,4 +20,6 @@ typedef enum foug_stl_format foug_stl_format_t; FOUG_DATAX_LIBSTL_EXPORT foug_stl_format_t foug_stl_get_format(foug_stream_t* stream, size_t data_size); +FOUG_C_LINKAGE_END + #endif /* FOUG_LIBSTL_FORMAT_H */ diff --git a/src/libstl/stl_io.h b/src/libstl/stl_io.h index 7b285f4..3885faf 100644 --- a/src/libstl/stl_io.h +++ b/src/libstl/stl_io.h @@ -7,6 +7,8 @@ #include "../endian.h" #include "../transfer.h" +FOUG_C_LINKAGE_BEGIN + /* * STL ascii */ @@ -37,4 +39,6 @@ FOUG_DATAX_LIBSTL_EXPORT int foug_stlb_write(const foug_stl_geom_t* geom, const uint8_t* header_data, foug_endianness_t byte_order); +FOUG_C_LINKAGE_END + #endif /* FOUG_DATAX_LIBSTL_STL_IO_H */ diff --git a/src/stream.h b/src/stream.h index 16360a4..95be6c2 100644 --- a/src/stream.h +++ b/src/stream.h @@ -4,6 +4,8 @@ #include "global.h" #include +FOUG_C_LINKAGE_BEGIN + /*! Stream that can get input from an arbitrary data source or can write output to an arbitrary * data sink */ @@ -55,4 +57,6 @@ FOUG_LIB_EXPORT size_t foug_stream_write(foug_stream_t* stream, size_t size, size_t count); +FOUG_C_LINKAGE_END + #endif /* FOUG_C_STREAM_H */ diff --git a/src/task_control.h b/src/task_control.h index a1c9940..6eb5566 100644 --- a/src/task_control.h +++ b/src/task_control.h @@ -4,6 +4,8 @@ #include "global.h" #include "memory.h" +FOUG_C_LINKAGE_BEGIN + /*! Provides control over a general task. * * "Control" here means task progress handling and interruption request (abort). @@ -26,4 +28,6 @@ FOUG_LIB_EXPORT foug_bool_t foug_task_control_handle_progress(foug_task_control_ /*! Utility function that converts \p value as a percentage */ FOUG_LIB_EXPORT uint8_t foug_percentage(size_t range_min, size_t range_max, size_t value); +FOUG_C_LINKAGE_END + #endif /* FOUG_C_TASK_CONTROL_H */