【发布时间】:2020-10-16 07:47:17
【问题描述】:
我有一个班级:
class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface { ... };
RTC_EXPORT 定义为
#ifndef RTC_BASE_SYSTEM_RTC_EXPORT_H_
#define RTC_BASE_SYSTEM_RTC_EXPORT_H_
// RTC_EXPORT is used to mark symbols as exported or imported when WebRTC is
// built or used as a shared library.
// When WebRTC is built as a static library the RTC_EXPORT macro expands to
// nothing.
#ifdef WEBRTC_ENABLE_SYMBOL_EXPORT
#ifdef WEBRTC_WIN
#ifdef WEBRTC_LIBRARY_IMPL
#define RTC_EXPORT __declspec(dllexport)
#else
#define RTC_EXPORT __declspec(dllimport)
#endif
#else // WEBRTC_WIN
#if __has_attribute(visibility) && defined(WEBRTC_LIBRARY_IMPL)
#define RTC_EXPORT __attribute__((visibility("default")))
#endif
#endif // WEBRTC_WIN
#endif // WEBRTC_ENABLE_SYMBOL_EXPORT
#ifndef RTC_EXPORT
#define RTC_EXPORT
#endif
#endif // RTC_BASE_SYSTEM_RTC_EXPORT_H_
class RTC_EXPORT PeerConnectionInterface :public rtc::RefCountInterface {...}; 中的 RTC_EXPORT 有什么作用?
通常我们在 c++ 中将类定义为class Myclass{...}。附加的 MACRO 一般有什么作用?
【问题讨论】: