Including C headers inside of extern "C" breaks use from C++. Hoist the includes of standard C headers above the block so we don't try to mangle the stdlib. See https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2377 in PipeWire where they bundle some JACK headers, so came across this.pull/1003/head
| @@ -21,17 +21,16 @@ | |||||
| #ifndef __jack_driver_interface_h__ | #ifndef __jack_driver_interface_h__ | ||||
| #define __jack_driver_interface_h__ | #define __jack_driver_interface_h__ | ||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| #include <limits.h> | #include <limits.h> | ||||
| #include "jslist.h" | #include "jslist.h" | ||||
| #include "JackCompilerDeps.h" | #include "JackCompilerDeps.h" | ||||
| #include "JackSystemDeps.h" | #include "JackSystemDeps.h" | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| #define JACK_DRIVER_NAME_MAX 15 | #define JACK_DRIVER_NAME_MAX 15 | ||||
| #define JACK_DRIVER_PARAM_NAME_MAX 15 | #define JACK_DRIVER_PARAM_NAME_MAX 15 | ||||
| #define JACK_DRIVER_PARAM_STRING_MAX 127 | #define JACK_DRIVER_PARAM_STRING_MAX 127 | ||||
| @@ -20,13 +20,13 @@ | |||||
| #ifndef __jack_intclient_h__ | #ifndef __jack_intclient_h__ | ||||
| #define __jack_intclient_h__ | #define __jack_intclient_h__ | ||||
| #include <jack/types.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | ||||
| { | { | ||||
| #endif | #endif | ||||
| #include <jack/types.h> | |||||
| /** | /** | ||||
| * Get an internal client's name. This is useful when @ref | * Get an internal client's name. This is useful when @ref | ||||
| * JackUseExactName was not specified on jack_internal_client_load() | * JackUseExactName was not specified on jack_internal_client_load() | ||||
| @@ -21,15 +21,16 @@ | |||||
| #ifndef __jack_h__ | #ifndef __jack_h__ | ||||
| #define __jack_h__ | #define __jack_h__ | ||||
| #include <jack/systemdeps.h> | |||||
| #include <jack/types.h> | |||||
| #include <jack/transport.h> | |||||
| #include <jack/weakmacros.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | ||||
| { | { | ||||
| #endif | #endif | ||||
| #include <jack/systemdeps.h> | |||||
| #include <jack/types.h> | |||||
| #include <jack/transport.h> | |||||
| /** | /** | ||||
| * Note: More documentation can be found in jack/types.h. | * Note: More documentation can be found in jack/types.h. | ||||
| */ | */ | ||||
| @@ -46,8 +47,6 @@ extern "C" | |||||
| * <jack/weakjack.h> before jack.h. | * <jack/weakjack.h> before jack.h. | ||||
| *************************************************************/ | *************************************************************/ | ||||
| #include <jack/weakmacros.h> | |||||
| /** | /** | ||||
| * Call this function to get version of the JACK, in form of several numbers | * Call this function to get version of the JACK, in form of several numbers | ||||
| * | * | ||||
| @@ -21,14 +21,13 @@ | |||||
| #ifndef __JACK_MIDIPORT_H | #ifndef __JACK_MIDIPORT_H | ||||
| #define __JACK_MIDIPORT_H | #define __JACK_MIDIPORT_H | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| #include <jack/weakmacros.h> | #include <jack/weakmacros.h> | ||||
| #include <jack/types.h> | #include <jack/types.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| /** Type for raw event data contained in @ref jack_midi_event_t. */ | /** Type for raw event data contained in @ref jack_midi_event_t. */ | ||||
| typedef unsigned char jack_midi_data_t; | typedef unsigned char jack_midi_data_t; | ||||
| @@ -20,15 +20,14 @@ | |||||
| #ifndef __net_h__ | #ifndef __net_h__ | ||||
| #define __net_h__ | #define __net_h__ | ||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| #include <jack/systemdeps.h> | #include <jack/systemdeps.h> | ||||
| #include <jack/types.h> | #include <jack/types.h> | ||||
| #include <jack/weakmacros.h> | #include <jack/weakmacros.h> | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| #define DEFAULT_MULTICAST_IP "225.3.19.154" | #define DEFAULT_MULTICAST_IP "225.3.19.154" | ||||
| #define DEFAULT_PORT 19000 | #define DEFAULT_PORT 19000 | ||||
| #define DEFAULT_MTU 1500 | #define DEFAULT_MTU 1500 | ||||
| @@ -21,13 +21,12 @@ | |||||
| #ifndef _RINGBUFFER_H | #ifndef _RINGBUFFER_H | ||||
| #define _RINGBUFFER_H | #define _RINGBUFFER_H | ||||
| #include <sys/types.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | |||||
| { | |||||
| extern "C" { | |||||
| #endif | #endif | ||||
| #include <sys/types.h> | |||||
| /** @file ringbuffer.h | /** @file ringbuffer.h | ||||
| * | * | ||||
| * A set of library functions to make lock-free ringbuffers available | * A set of library functions to make lock-free ringbuffers available | ||||
| @@ -21,13 +21,13 @@ | |||||
| #ifndef __jack_session_h__ | #ifndef __jack_session_h__ | ||||
| #define __jack_session_h__ | #define __jack_session_h__ | ||||
| #include <jack/types.h> | |||||
| #include <jack/weakmacros.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| #include <jack/types.h> | |||||
| #include <jack/weakmacros.h> | |||||
| /** | /** | ||||
| * @defgroup SessionClientFunctions Session API for clients. | * @defgroup SessionClientFunctions Session API for clients. | ||||
| * | * | ||||
| @@ -21,13 +21,12 @@ | |||||
| #ifndef __statistics_h__ | #ifndef __statistics_h__ | ||||
| #define __statistics_h__ | #define __statistics_h__ | ||||
| #include <jack/types.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | |||||
| { | |||||
| extern "C" { | |||||
| #endif | #endif | ||||
| #include <jack/types.h> | |||||
| /** | /** | ||||
| * @return the maximum delay reported by the backend since | * @return the maximum delay reported by the backend since | ||||
| * startup or reset. When compared to the period size in usecs, this | * startup or reset. When compared to the period size in usecs, this | ||||
| @@ -20,14 +20,14 @@ | |||||
| #ifndef __jack_thread_h__ | #ifndef __jack_thread_h__ | ||||
| #define __jack_thread_h__ | #define __jack_thread_h__ | ||||
| #include <jack/systemdeps.h> | |||||
| #include <jack/weakmacros.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" | extern "C" | ||||
| { | { | ||||
| #endif | #endif | ||||
| #include <jack/systemdeps.h> | |||||
| #include <jack/weakmacros.h> | |||||
| /* use 512KB stack per thread - the default is way too high to be feasible | /* use 512KB stack per thread - the default is way too high to be feasible | ||||
| * with mlockall() on many systems */ | * with mlockall() on many systems */ | ||||
| #define THREAD_STACK 524288 | #define THREAD_STACK 524288 | ||||
| @@ -21,13 +21,13 @@ | |||||
| #ifndef __jack_transport_h__ | #ifndef __jack_transport_h__ | ||||
| #define __jack_transport_h__ | #define __jack_transport_h__ | ||||
| #include <jack/types.h> | |||||
| #include <jack/weakmacros.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| #include <jack/types.h> | |||||
| #include <jack/weakmacros.h> | |||||
| /** | /** | ||||
| * @defgroup TransportControl Transport and Timebase control | * @defgroup TransportControl Transport and Timebase control | ||||
| * @{ | * @{ | ||||
| @@ -27,16 +27,15 @@ | |||||
| #ifndef __JACK_NET_PACKET_H__ | #ifndef __JACK_NET_PACKET_H__ | ||||
| #define __JACK_NET_PACKET_H__ | #define __JACK_NET_PACKET_H__ | ||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| #include <jack/jack.h> | #include <jack/jack.h> | ||||
| #include <jack/types.h> | #include <jack/types.h> | ||||
| #include <jack/jslist.h> | #include <jack/jslist.h> | ||||
| #include <jack/midiport.h> | #include <jack/midiport.h> | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| // The Packet Header. | // The Packet Header. | ||||
| #define CELT_MODE 1000 // Magic bitdepth value that indicates CELT compression | #define CELT_MODE 1000 // Magic bitdepth value that indicates CELT compression | ||||
| @@ -21,11 +21,6 @@ | |||||
| #ifndef __external_metro__ | #ifndef __external_metro__ | ||||
| #define __external_metro__ | #define __external_metro__ | ||||
| #ifdef __cplusplus | |||||
| extern "C" | |||||
| { | |||||
| #endif | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <errno.h> | #include <errno.h> | ||||
| @@ -36,6 +31,10 @@ extern "C" | |||||
| #include <jack/jack.h> | #include <jack/jack.h> | ||||
| #include <jack/transport.h> | #include <jack/transport.h> | ||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| typedef jack_default_audio_sample_t sample_t; | typedef jack_default_audio_sample_t sample_t; | ||||
| /*! | /*! | ||||