fixed more link issues on windows. examples build with shared linking on windows

This commit is contained in:
Arvid Norberg 2009-12-02 17:46:25 +00:00
parent 1e654220fa
commit bd881ac154
16 changed files with 65 additions and 57 deletions

View File

@ -447,6 +447,10 @@ local usage-requirements =
<toolset>msvc,<variant>release:<linkflags>/OPT:REF
# disable warning C4503: decorated name length exceeded, name was truncated
<toolset>msvc:<cxxflags>/wd4503
# disable warning C4275: non-dll interface class 'x' used as base for dll-interface struct 'y'
<toolset>msvc:<cxxflags>/wd4275
# disable warning C4251: 'x' needs to have dll-interface to be used by clients of class 'y'
<toolset>msvc:<cxxflags>/wd4251
# disable some warnings for gcc
<toolset>gcc:<cflags>-fno-strict-aliasing
<toolset>gcc:<cflags>-Wno-missing-braces

View File

@ -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&);

View File

@ -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<void()> const& queue_callback

View File

@ -42,27 +42,27 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
boost::array<char, 3 + std::numeric_limits<size_type>::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<char, 3 + std::numeric_limits<size_type>::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);

View File

@ -74,7 +74,7 @@ typedef boost::function<void(http_connection&, std::list<tcp::endpoint>&)> http_
// when bottled, the last two arguments to the handler
// will always be 0
struct http_connection : boost::enable_shared_from_this<http_connection>, boost::noncopyable
struct TORRENT_EXPORT http_connection : boost::enable_shared_from_this<http_connection>, boost::noncopyable
{
http_connection(io_service& ios, connection_queue& cc
, http_handler const& handler, bool bottled = true

View File

@ -55,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
class http_parser
class TORRENT_EXPORT http_parser
{
public:
http_parser();

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <set>
#include <libtorrent/config.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>
#include <libtorrent/kademlia/node_id.hpp>
@ -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) {}

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <algorithm>
#include <boost/cstdint.hpp>
#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

View File

@ -156,7 +156,7 @@ namespace aux
} // namespace aux
class routing_table
class TORRENT_EXPORT routing_table
{
public:
typedef aux::routing_table_iterator iterator;

View File

@ -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 <gcrypt.h>
#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();

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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)
{

View File

@ -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()
{