diff --git a/Jamfile b/Jamfile index b084d2450..761507c0c 100755 --- a/Jamfile +++ b/Jamfile @@ -447,6 +447,10 @@ local usage-requirements = msvc,release:/OPT:REF # disable warning C4503: decorated name length exceeded, name was truncated msvc:/wd4503 +# disable warning C4275: non-dll interface class 'x' used as base for dll-interface struct 'y' + msvc:/wd4275 +# disable warning C4251: 'x' needs to have dll-interface to be used by clients of class 'y' + msvc:/wd4251 # disable some warnings for gcc gcc:-fno-strict-aliasing gcc:-Wno-missing-braces diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index e7e407db3..e13669d1f 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -54,7 +54,7 @@ namespace libtorrent // determines if the operating system supports IPv6 TORRENT_EXPORT bool supports_ipv6(); - int common_bits(unsigned char const* b1 + TORRENT_EXPORT int common_bits(unsigned char const* b1 , unsigned char const* b2, int n); TORRENT_EXPORT address guess_local_address(io_service&); diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index a03e878fa..69b7d2ed7 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -181,7 +181,7 @@ namespace libtorrent mutable int total_used_buffers; }; - struct disk_buffer_pool : boost::noncopyable + struct TORRENT_EXPORT disk_buffer_pool : boost::noncopyable { disk_buffer_pool(int block_size); #ifdef TORRENT_DEBUG @@ -255,7 +255,7 @@ namespace libtorrent // this is a singleton consisting of the thread and a queue // of disk io jobs - struct disk_io_thread : disk_buffer_pool + struct TORRENT_EXPORT disk_io_thread : disk_buffer_pool { disk_io_thread(io_service& ios , boost::function const& queue_callback diff --git a/include/libtorrent/escape_string.hpp b/include/libtorrent/escape_string.hpp index fcb3d5426..5c9b05807 100644 --- a/include/libtorrent/escape_string.hpp +++ b/include/libtorrent/escape_string.hpp @@ -42,27 +42,27 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - boost::array::digits10> TORRENT_EXPORT to_string(size_type n); - bool TORRENT_EXPORT is_alpha(char c); - bool TORRENT_EXPORT is_digit(char c); - bool TORRENT_EXPORT is_print(char c); - bool TORRENT_EXPORT is_space(char c); - char TORRENT_EXPORT to_lower(char c); + TORRENT_EXPORT boost::array::digits10> to_string(size_type n); + TORRENT_EXPORT bool is_alpha(char c); + TORRENT_EXPORT bool is_digit(char c); + TORRENT_EXPORT bool is_print(char c); + TORRENT_EXPORT bool is_space(char c); + TORRENT_EXPORT char to_lower(char c); - int TORRENT_EXPORT split_string(char const** tags, int buf_size, char* in); - bool TORRENT_EXPORT string_begins_no_case(char const* s1, char const* s2); - bool TORRENT_EXPORT string_equal_no_case(char const* s1, char const* s2); + TORRENT_EXPORT int split_string(char const** tags, int buf_size, char* in); + TORRENT_EXPORT bool string_begins_no_case(char const* s1, char const* s2); + TORRENT_EXPORT bool string_equal_no_case(char const* s1, char const* s2); - std::string TORRENT_EXPORT unescape_string(std::string const& s, error_code& ec); + TORRENT_EXPORT std::string unescape_string(std::string const& s, error_code& ec); // replaces all disallowed URL characters by their %-encoding - std::string TORRENT_EXPORT escape_string(const char* str, int len); + TORRENT_EXPORT std::string escape_string(const char* str, int len); // same as escape_string but does not encode '/' - std::string TORRENT_EXPORT escape_path(const char* str, int len); + TORRENT_EXPORT std::string escape_path(const char* str, int len); // if the url does not appear to be encoded, and it contains illegal url characters // it will be encoded - std::string TORRENT_EXPORT maybe_url_encode(std::string const& url); + TORRENT_EXPORT std::string maybe_url_encode(std::string const& url); - bool TORRENT_EXPORT need_encoding(char const* str, int len); + TORRENT_EXPORT bool need_encoding(char const* str, int len); // encodes a string using the base64 scheme TORRENT_EXPORT std::string base64encode(std::string const& s); diff --git a/include/libtorrent/http_connection.hpp b/include/libtorrent/http_connection.hpp index 6902f89bf..763e657fb 100644 --- a/include/libtorrent/http_connection.hpp +++ b/include/libtorrent/http_connection.hpp @@ -74,7 +74,7 @@ typedef boost::function&)> http_ // when bottled, the last two arguments to the handler // will always be 0 -struct http_connection : boost::enable_shared_from_this, boost::noncopyable +struct TORRENT_EXPORT http_connection : boost::enable_shared_from_this, boost::noncopyable { http_connection(io_service& ios, connection_queue& cc , http_handler const& handler, bool bottled = true diff --git a/include/libtorrent/http_parser.hpp b/include/libtorrent/http_parser.hpp index 34da87e52..0a615413e 100644 --- a/include/libtorrent/http_parser.hpp +++ b/include/libtorrent/http_parser.hpp @@ -55,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - class http_parser + class TORRENT_EXPORT http_parser { public: http_parser(); diff --git a/include/libtorrent/kademlia/node.hpp b/include/libtorrent/kademlia/node.hpp index 810b05d44..a41a7d971 100644 --- a/include/libtorrent/kademlia/node.hpp +++ b/include/libtorrent/kademlia/node.hpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include #include @@ -67,7 +68,7 @@ namespace libtorrent { namespace dht TORRENT_DECLARE_LOG(node); #endif -class traversal_algorithm; +struct traversal_algorithm; struct key_desc_t { @@ -99,7 +100,7 @@ struct torrent_entry // this is the entry for a torrent that has been published // in the DHT. -struct search_torrent_entry +struct TORRENT_EXPORT search_torrent_entry { search_torrent_entry(): total_tag_points(0), total_name_points(0) {} diff --git a/include/libtorrent/kademlia/node_id.hpp b/include/libtorrent/kademlia/node_id.hpp index 4173808c9..48f50151e 100644 --- a/include/libtorrent/kademlia/node_id.hpp +++ b/include/libtorrent/kademlia/node_id.hpp @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include "libtorrent/config.hpp" #include "libtorrent/peer_id.hpp" #include "libtorrent/assert.hpp" @@ -45,16 +46,16 @@ typedef libtorrent::big_number node_id; // returns the distance between the two nodes // using the kademlia XOR-metric -node_id distance(node_id const& n1, node_id const& n2); +node_id TORRENT_EXPORT distance(node_id const& n1, node_id const& n2); // returns true if: distance(n1, ref) < distance(n2, ref) -bool compare_ref(node_id const& n1, node_id const& n2, node_id const& ref); +bool TORRENT_EXPORT compare_ref(node_id const& n1, node_id const& n2, node_id const& ref); // returns n in: 2^n <= distance(n1, n2) < 2^(n+1) // usefult for finding out which bucket a node belongs to -int distance_exp(node_id const& n1, node_id const& n2); +int TORRENT_EXPORT distance_exp(node_id const& n1, node_id const& n2); -node_id generate_id(); +node_id TORRENT_EXPORT generate_id(); } } // namespace libtorrent::dht diff --git a/include/libtorrent/kademlia/routing_table.hpp b/include/libtorrent/kademlia/routing_table.hpp index 5749c5649..160a720c2 100644 --- a/include/libtorrent/kademlia/routing_table.hpp +++ b/include/libtorrent/kademlia/routing_table.hpp @@ -156,7 +156,7 @@ namespace aux } // namespace aux -class routing_table +class TORRENT_EXPORT routing_table { public: typedef aux::routing_table_iterator iterator; diff --git a/include/libtorrent/pe_crypto.hpp b/include/libtorrent/pe_crypto.hpp index c89cbb08e..2d4f58c54 100644 --- a/include/libtorrent/pe_crypto.hpp +++ b/include/libtorrent/pe_crypto.hpp @@ -35,6 +35,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_PE_CRYPTO_HPP_INCLUDED #define TORRENT_PE_CRYPTO_HPP_INCLUDED +#include "libtorrent/config.hpp" + #ifdef TORRENT_USE_GCRYPT #include #elif defined TORRENT_USE_OPENSSL @@ -46,8 +48,8 @@ struct rc4 { unsigned char buf[256]; }; -void rc4_init(const unsigned char* in, unsigned long len, rc4 *state); -unsigned long rc4_encrypt(unsigned char *out, unsigned long outlen, rc4 *state); +void TORRENT_EXPORT rc4_init(const unsigned char* in, unsigned long len, rc4 *state); +unsigned long TORRENT_EXPORT rc4_encrypt(unsigned char *out, unsigned long outlen, rc4 *state); #endif #include "libtorrent/peer_id.hpp" // For sha1_hash @@ -55,7 +57,7 @@ unsigned long rc4_encrypt(unsigned char *out, unsigned long outlen, rc4 *state); namespace libtorrent { - class dh_key_exchange + class TORRENT_EXPORT dh_key_exchange { public: dh_key_exchange(); diff --git a/include/libtorrent/ptime.hpp b/include/libtorrent/ptime.hpp index 5cd0164d5..5429b597a 100644 --- a/include/libtorrent/ptime.hpp +++ b/include/libtorrent/ptime.hpp @@ -122,14 +122,14 @@ namespace libtorrent namespace libtorrent { - ptime TORRENT_EXPORT time_now_hires(); - ptime TORRENT_EXPORT min_time(); - ptime TORRENT_EXPORT max_time(); + TORRENT_EXPORT ptime time_now_hires(); + TORRENT_EXPORT ptime min_time(); + TORRENT_EXPORT ptime max_time(); - char const* time_now_string(); - std::string TORRENT_EXPORT log_time(); + TORRENT_EXPORT char const* time_now_string(); + TORRENT_EXPORT std::string log_time(); - ptime const& TORRENT_EXPORT time_now(); + TORRENT_EXPORT ptime const& time_now(); } #endif diff --git a/include/libtorrent/socket_type.hpp b/include/libtorrent/socket_type.hpp index be6a4ead1..8df54abb5 100644 --- a/include/libtorrent/socket_type.hpp +++ b/include/libtorrent/socket_type.hpp @@ -121,7 +121,7 @@ namespace libtorrent { enum { value = 4 }; }; #endif - struct socket_type + struct TORRENT_EXPORT socket_type { typedef stream_socket::lowest_layer_type lowest_layer_type; typedef stream_socket::endpoint_type endpoint_type; diff --git a/include/libtorrent/time.hpp b/include/libtorrent/time.hpp index ab9ee4e9f..8a44a65ef 100644 --- a/include/libtorrent/time.hpp +++ b/include/libtorrent/time.hpp @@ -41,31 +41,31 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - char const* time_now_string(); - std::string TORRENT_EXPORT log_time(); + TORRENT_EXPORT char const* time_now_string(); + TORRENT_EXPORT std::string log_time(); - ptime TORRENT_EXPORT time_now_hires(); - ptime TORRENT_EXPORT min_time(); - ptime TORRENT_EXPORT max_time(); + TORRENT_EXPORT ptime time_now_hires(); + TORRENT_EXPORT ptime min_time(); + TORRENT_EXPORT ptime max_time(); #if defined TORRENT_USE_BOOST_DATE_TIME - time_duration TORRENT_EXPORT seconds(int s); - time_duration TORRENT_EXPORT milliseconds(int s); - time_duration TORRENT_EXPORT microsec(int s); - time_duration TORRENT_EXPORT minutes(int s); - time_duration TORRENT_EXPORT hours(int s); + TORRENT_EXPORT time_duration seconds(int s); + TORRENT_EXPORT time_duration milliseconds(int s); + TORRENT_EXPORT time_duration microsec(int s); + TORRENT_EXPORT time_duration minutes(int s); + TORRENT_EXPORT time_duration hours(int s); - int TORRENT_EXPORT total_seconds(time_duration td); - int TORRENT_EXPORT total_milliseconds(time_duration td); - boost::int64_t TORRENT_EXPORT total_microseconds(time_duration td); + TORRENT_EXPORT int total_seconds(time_duration td); + TORRENT_EXPORT int total_milliseconds(time_duration td); + TORRENT_EXPORT boost::int64_t total_microseconds(time_duration td); #elif defined TORRENT_USE_QUERY_PERFORMANCE_TIMER namespace aux { - boost::int64_t TORRENT_EXPORT performance_counter_to_microseconds(boost::int64_t pc); - boost::int64_t TORRENT_EXPORT microseconds_to_performance_counter(boost::int64_t ms); + TORRENT_EXPORT boost::int64_t performance_counter_to_microseconds(boost::int64_t pc); + TORRENT_EXPORT boost::int64_t microseconds_to_performance_counter(boost::int64_t ms); } inline int total_seconds(time_duration td) diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index a62217230..e77f7e7c9 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -96,7 +96,7 @@ namespace libtorrent // fixes invalid UTF-8 sequences and // replaces characters that are invalid // in paths - bool verify_encoding(std::string& target, bool fix_paths = false) + TORRENT_EXPORT bool verify_encoding(std::string& target, bool fix_paths = false) { std::string tmp_path; bool valid_encoding = true; @@ -223,7 +223,7 @@ namespace libtorrent } } - std::string sanitize_path(std::string const& p) + TORRENT_EXPORT std::string sanitize_path(std::string const& p) { std::string new_path; std::string split = split_path(p); diff --git a/src/upnp.cpp b/src/upnp.cpp index 36527c7a0..006147765 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -787,7 +787,7 @@ struct parse_state } }; -void find_control_url(int type, char const* string, parse_state& state) +TORRENT_EXPORT void find_control_url(int type, char const* string, parse_state& state) { if (type == xml_start_tag) { diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index 0a39a1ebb..3b680877c 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -58,7 +58,7 @@ using namespace boost::tuples; using boost::bind; namespace libtorrent { - std::string sanitize_path(std::string const& p); + TORRENT_EXPORT std::string sanitize_path(std::string const& p); } sha1_hash to_hash(char const* s) @@ -358,10 +358,10 @@ struct parse_state namespace libtorrent { // defined in torrent_info.cpp - bool verify_encoding(std::string& target, bool path = true); + TORRENT_EXPORT bool verify_encoding(std::string& target, bool path = true); } -void find_control_url(int type, char const* string, parse_state& state); +TORRENT_EXPORT void find_control_url(int type, char const* string, parse_state& state); int test_main() {