Browse Source

Start exporting c++ API for windows.

Hanseul Jun 4 years ago
parent
commit
12098e7c41

+ 1 - 1
include/rtc/candidate.hpp

@@ -25,7 +25,7 @@
 
 namespace rtc {
 
-class Candidate {
+class RTC_CPP_EXPORT Candidate {
 public:
 	enum class Family { Unresolved, Ipv4, Ipv6 };
 	enum class Type { Unknown, Host, ServerReflexive, PeerReflexive, Relayed };

+ 1 - 1
include/rtc/channel.hpp

@@ -28,7 +28,7 @@
 
 namespace rtc {
 
-class Channel {
+class RTC_CPP_EXPORT Channel {
 public:
 	Channel() = default;
 	virtual ~Channel() = default;

+ 1 - 1
include/rtc/configuration.hpp

@@ -26,7 +26,7 @@
 
 namespace rtc {
 
-struct IceServer {
+struct RTC_CPP_EXPORT IceServer {
 	enum class Type { Stun, Turn };
 	enum class RelayType { TurnUdp, TurnTcp, TurnTls };
 

+ 1 - 1
include/rtc/datachannel.hpp

@@ -36,7 +36,7 @@ namespace rtc {
 class SctpTransport;
 class PeerConnection;
 
-class DataChannel : public std::enable_shared_from_this<DataChannel>, public Channel {
+class RTC_CPP_EXPORT DataChannel : public std::enable_shared_from_this<DataChannel>, public Channel {
 public:
 	DataChannel(std::weak_ptr<PeerConnection> pc, uint16_t stream, string label, string protocol,
 	            Reliability reliability);

+ 1 - 1
include/rtc/description.hpp

@@ -32,7 +32,7 @@
 
 namespace rtc {
 
-class Description {
+class RTC_CPP_EXPORT Description {
 public:
 	enum class Type { Unspec, Offer, Answer, Pranswer, Rollback };
 	enum class Role { ActPass, Passive, Active };

+ 3 - 0
include/rtc/include.hpp

@@ -28,9 +28,12 @@
 #endif
 
 #ifdef _WIN32
+#define RTC_CPP_EXPORT __declspec(dllexport)
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0602 // Windows 8
 #endif
+#else
+#define RTC_CPP_EXPORT
 #endif
 
 #include "log.hpp"

+ 8 - 2
include/rtc/log.hpp

@@ -35,6 +35,12 @@
 #pragma warning(pop)
 #endif
 
+#ifdef _WIN32
+#define RTC_CPP_EXPORT __declspec(dllexport)
+#else
+#define RTC_CPP_EXPORT
+#endif
+
 namespace rtc {
 
 enum class LogLevel { // Don't change, it must match plog severity
@@ -47,8 +53,8 @@ enum class LogLevel { // Don't change, it must match plog severity
 	Verbose = 6
 };
 
-void InitLogger(LogLevel level);
-void InitLogger(plog::Severity severity, plog::IAppender *appender = nullptr);
+RTC_CPP_EXPORT void InitLogger(LogLevel level);
+RTC_CPP_EXPORT void InitLogger(plog::Severity severity, plog::IAppender *appender = nullptr);
 } // namespace rtc
 
 #endif

+ 4 - 4
include/rtc/peerconnection.hpp

@@ -57,7 +57,7 @@ struct DataChannelInit {
 	string protocol = "";
 };
 
-class PeerConnection final : public std::enable_shared_from_this<PeerConnection> {
+class RTC_CPP_EXPORT PeerConnection final : public std::enable_shared_from_this<PeerConnection> {
 public:
 	enum class State : int {
 		New = RTC_NEW,
@@ -203,8 +203,8 @@ private:
 
 } // namespace rtc
 
-std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::State state);
-std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::GatheringState state);
-std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::SignalingState state);
+RTC_CPP_EXPORT std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::State state);
+RTC_CPP_EXPORT std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::GatheringState state);
+RTC_CPP_EXPORT std::ostream &operator<<(std::ostream &out, rtc::PeerConnection::SignalingState state);
 
 #endif