RTCMacros.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  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. #ifndef SDK_OBJC_BASE_RTCMACROS_H_
  11. #define SDK_OBJC_BASE_RTCMACROS_H_
  12. #ifdef WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT
  13. #if defined(WEBRTC_LIBRARY_IMPL)
  14. #define RTC_OBJC_EXPORT __attribute__((visibility("default")))
  15. #endif
  16. #endif // WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT
  17. #ifndef RTC_OBJC_EXPORT
  18. #define RTC_OBJC_EXPORT
  19. #endif
  20. // Internal macros used to correctly concatenate symbols.
  21. #define RTC_SYMBOL_CONCAT_HELPER(a, b) a##b
  22. #define RTC_SYMBOL_CONCAT(a, b) RTC_SYMBOL_CONCAT_HELPER(a, b)
  23. // RTC_OBJC_TYPE_PREFIX
  24. //
  25. // Macro used to prepend a prefix to the API types that are exported with
  26. // RTC_OBJC_EXPORT.
  27. //
  28. // Clients can patch the definition of this macro locally and build
  29. // WebRTC.framework with their own prefix in case symbol clashing is a
  30. // problem.
  31. //
  32. // This macro must be defined uniformily across all the translation units.
  33. #ifndef RTC_OBJC_TYPE_PREFIX
  34. #define RTC_OBJC_TYPE_PREFIX
  35. #endif
  36. // RCT_OBJC_TYPE
  37. //
  38. // Macro used internally to declare API types. Declaring an API type without
  39. // using this macro will not include the declared type in the set of types
  40. // that will be affected by the configurable RTC_OBJC_TYPE_PREFIX.
  41. #define RTC_OBJC_TYPE(type_name) RTC_SYMBOL_CONCAT(RTC_OBJC_TYPE_PREFIX, type_name)
  42. #if defined(__cplusplus)
  43. #define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
  44. #else
  45. #define RTC_EXTERN extern RTC_OBJC_EXPORT
  46. #endif
  47. #ifdef __OBJC__
  48. #define RTC_FWD_DECL_OBJC_CLASS(classname) @class classname
  49. #else
  50. #define RTC_FWD_DECL_OBJC_CLASS(classname) typedef struct objc_object classname
  51. #endif
  52. #endif // SDK_OBJC_BASE_RTCMACROS_H_