blob: b5a79113b82d6d64c6b0b3a026911257e3ccf603 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef SDK_OBJC_BASE_RTCMACROS_H_
12#define SDK_OBJC_BASE_RTCMACROS_H_
13
Mirko Bonadeic1254e82020-12-17 15:56:13 +010014#ifdef WEBRTC_ENABLE_SYMBOL_EXPORT
15
16#if defined(WEBRTC_LIBRARY_IMPL)
17#define RTC_OBJC_EXPORT __attribute__((visibility("default")))
18#endif
19
20#endif // WEBRTC_ENABLE_SYMBOL_EXPORT
21
22#ifndef RTC_OBJC_EXPORT
23#define RTC_OBJC_EXPORT
24#endif
25
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020026// Internal macros used to correctly concatenate symbols.
27#define RTC_SYMBOL_CONCAT_HELPER(a, b) a##b
28#define RTC_SYMBOL_CONCAT(a, b) RTC_SYMBOL_CONCAT_HELPER(a, b)
29
30// RTC_OBJC_TYPE_PREFIX
31//
32// Macro used to prepend a prefix to the API types that are exported with
33// RTC_OBJC_EXPORT.
34//
35// Clients can patch the definition of this macro locally and build
36// WebRTC.framework with their own prefix in case symbol clashing is a
37// problem.
38//
39// This macro must only be defined here and not on via compiler flag to
40// ensure it has a unique value.
41#define RTC_OBJC_TYPE_PREFIX
42
43// RCT_OBJC_TYPE
44//
45// Macro used internally to declare API types. Declaring an API type without
46// using this macro will not include the declared type in the set of types
47// that will be affected by the configurable RTC_OBJC_TYPE_PREFIX.
48#define RTC_OBJC_TYPE(type_name) RTC_SYMBOL_CONCAT(RTC_OBJC_TYPE_PREFIX, type_name)
49
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020050#if defined(__cplusplus)
Mirko Bonadeie8d57242018-09-17 10:22:56 +020051#define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020052#else
Mirko Bonadeie8d57242018-09-17 10:22:56 +020053#define RTC_EXTERN extern RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020054#endif
55
56#ifdef __OBJC__
57#define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
58#else
59#define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
60#endif
61
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020062#endif // SDK_OBJC_BASE_RTCMACROS_H_