windows build fixes

This commit is contained in:
Arvid Norberg 2010-12-01 05:47:18 +00:00
parent f4746f4090
commit 94ef3eaf4b
13 changed files with 29 additions and 10 deletions

View File

@ -83,7 +83,6 @@ rule linking ( properties * )
<library>wsock32 <library>wsock32
<library>iphlpapi <library>iphlpapi
<define>WIN32_LEAN_AND_MEAN <define>WIN32_LEAN_AND_MEAN
<define>_WIN32_WINNT=0x0600
<define>__USE_W32_SOCKETS <define>__USE_W32_SOCKETS
<define>WIN32 <define>WIN32
<define>_WIN32 <define>_WIN32
@ -242,6 +241,12 @@ feature asserts : on off production : composite propagated ;
feature.compose <asserts>production : <define>TORRENT_PRODUCTION_ASSERTS=1 ; feature.compose <asserts>production : <define>TORRENT_PRODUCTION_ASSERTS=1 ;
feature.compose <asserts>off : <define>TORRENT_NO_ASSERTS=1 ; feature.compose <asserts>off : <define>TORRENT_NO_ASSERTS=1 ;
feature windows-version : 2k xp vista win7 : composite propagated link-incompatible ;
feature.compose <windows-version>2k : <define>_WIN32_WINNT=0x0500 ;
feature.compose <windows-version>xp : <define>_WIN32_WINNT=0x0501 ;
feature.compose <windows-version>vista : <define>_WIN32_WINNT=0x0600 ;
feature.compose <windows-version>win7 : <define>_WIN32_WINNT=0x0601 ;
feature asio-debugging : off on : composite propagated link-incompatible ; feature asio-debugging : off on : composite propagated link-incompatible ;
feature.compose <asio-debugging>on : <define>TORRENT_ASIO_DEBUGGING ; feature.compose <asio-debugging>on : <define>TORRENT_ASIO_DEBUGGING ;

View File

@ -74,7 +74,7 @@ namespace libtorrent
// it's smaller and optimized for smaller memory // it's smaller and optimized for smaller memory
// footprint, as opposed to file_entry, which is // footprint, as opposed to file_entry, which is
// optimized for convenience // optimized for convenience
struct internal_file_entry struct TORRENT_EXPORT internal_file_entry
{ {
friend class file_storage; friend class file_storage;
internal_file_entry() internal_file_entry()

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/function/function1.hpp> #include <boost/function/function1.hpp>
#include "libtorrent/proxy_base.hpp" #include "libtorrent/proxy_base.hpp"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
namespace libtorrent { namespace libtorrent {

View File

@ -41,7 +41,7 @@ namespace libtorrent
struct proxy_settings; struct proxy_settings;
struct utp_socket_manager; struct utp_socket_manager;
bool instantiate_connection(io_service& ios TORRENT_EXPORT bool instantiate_connection(io_service& ios
, proxy_settings const& ps, socket_type& s , proxy_settings const& ps, socket_type& s
, void* ssl_context = 0 , void* ssl_context = 0
, utp_socket_manager* sm = 0); , utp_socket_manager* sm = 0);

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_PACKET_BUFFER_HPP_INCLUDED #ifndef TORRENT_PACKET_BUFFER_HPP_INCLUDED
#define TORRENT_PACKET_BUFFER_HPP_INCLUDED #define TORRENT_PACKET_BUFFER_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "boost/cstdint.hpp" #include "boost/cstdint.hpp"
#include <cstddef> #include <cstddef>
@ -64,7 +65,7 @@ namespace libtorrent
// whenever the element at the cursor is removed, the // whenever the element at the cursor is removed, the
// cursor is bumped to the next occupied element // cursor is bumped to the next occupied element
class packet_buffer class TORRENT_EXPORT packet_buffer
{ {
public: public:
typedef boost::uint32_t index_type; typedef boost::uint32_t index_type;

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/function/function1.hpp> #include <boost/function/function1.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "libtorrent/proxy_base.hpp" #include "libtorrent/proxy_base.hpp"
namespace libtorrent { namespace libtorrent {

View File

@ -40,6 +40,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include <memory> // for auto_ptr required by asio
#include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/thread.hpp>
#include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/mutex.hpp>
#include <boost/asio/detail/event.hpp> #include <boost/asio/detail/event.hpp>
@ -50,9 +52,9 @@ namespace libtorrent
typedef boost::asio::detail::mutex mutex; typedef boost::asio::detail::mutex mutex;
typedef boost::asio::detail::event event; typedef boost::asio::detail::event event;
void sleep(int milliseconds); TORRENT_EXPORT void sleep(int milliseconds);
struct condition struct TORRENT_EXPORT condition
{ {
condition(); condition();
~condition(); ~condition();

View File

@ -162,7 +162,7 @@ int socket_impl_size();
// will keep the utp_stream object around for. // will keep the utp_stream object around for.
// for more details, see utp_socket_impl, which is analogous // for more details, see utp_socket_impl, which is analogous
// to the kernel state for a socket. It's defined in utp_stream.cpp // to the kernel state for a socket. It's defined in utp_stream.cpp
class utp_stream class TORRENT_EXPORT utp_stream
{ {
public: public:

View File

@ -454,6 +454,7 @@ namespace libtorrent
#elif defined TORRENT_WINDOWS || defined TORRENT_MINGW #elif defined TORRENT_WINDOWS || defined TORRENT_MINGW
#if _WIN32_WINNT >= 0x0501
// Load Iphlpapi library // Load Iphlpapi library
HMODULE iphlp = LoadLibraryA("Iphlpapi.dll"); HMODULE iphlp = LoadLibraryA("Iphlpapi.dll");
if (iphlp) if (iphlp)
@ -512,6 +513,7 @@ namespace libtorrent
} }
FreeLibrary(iphlp); FreeLibrary(iphlp);
} }
#endif
SOCKET s = socket(AF_INET, SOCK_DGRAM, 0); SOCKET s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == SOCKET_ERROR) if (s == SOCKET_ERROR)
@ -803,6 +805,7 @@ namespace libtorrent
return std::vector<ip_route>(); return std::vector<ip_route>();
} }
#if _WIN32_WINNT >= 0x0600
typedef DWORD (WINAPI *GetIpForwardTable2_t)( typedef DWORD (WINAPI *GetIpForwardTable2_t)(
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*); ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
typedef void (WINAPI *FreeMibTable_t)(PVOID Memory); typedef void (WINAPI *FreeMibTable_t)(PVOID Memory);
@ -839,6 +842,7 @@ namespace libtorrent
FreeLibrary(iphlp); FreeLibrary(iphlp);
return ret; return ret;
} }
#endif
// Get GetIpForwardTable() pointer // Get GetIpForwardTable() pointer
typedef DWORD (WINAPI *GetIpForwardTable_t)(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,BOOL bOrder); typedef DWORD (WINAPI *GetIpForwardTable_t)(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,BOOL bOrder);

View File

@ -88,6 +88,7 @@ namespace libtorrent
#if _WIN32_WINNT >= 0x0600 #if _WIN32_WINNT >= 0x0600
if (m_low_prio_io) if (m_low_prio_io)
{ {
// TODO: load this function dynamically from Kernel32.dll
FILE_IO_PRIORITY_HINT_INFO priorityHint; FILE_IO_PRIORITY_HINT_INFO priorityHint;
priorityHint.PriorityHint = IoPriorityHintLow; priorityHint.PriorityHint = IoPriorityHintLow;
SetFileInformationByHandle(e.file_ptr->native_handle(), SetFileInformationByHandle(e.file_ptr->native_handle(),

View File

@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
bool instantiate_connection(io_service& ios TORRENT_EXPORT bool instantiate_connection(io_service& ios
, proxy_settings const& ps, socket_type& s , proxy_settings const& ps, socket_type& s
, void* ssl_context , void* ssl_context
, utp_socket_manager* sm) , utp_socket_manager* sm)

View File

@ -52,8 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <fstream> #include <fstream>
#endif #endif
using boost::shared_ptr;
namespace libtorrent { namespace dht namespace libtorrent { namespace dht
{ {

View File

@ -714,7 +714,9 @@ namespace aux {
PRINT_OFFSETOF(udp_socket, m_socks5_sock) PRINT_OFFSETOF(udp_socket, m_socks5_sock)
PRINT_OFFSETOF(udp_socket, m_connection_ticket) PRINT_OFFSETOF(udp_socket, m_connection_ticket)
PRINT_OFFSETOF(udp_socket, m_proxy_settings) PRINT_OFFSETOF(udp_socket, m_proxy_settings)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_socket, m_cc) PRINT_OFFSETOF(udp_socket, m_cc)
#endif
PRINT_OFFSETOF(udp_socket, m_resolver) PRINT_OFFSETOF(udp_socket, m_resolver)
PRINT_OFFSETOF(udp_socket, m_tmp_buf) PRINT_OFFSETOF(udp_socket, m_tmp_buf)
PRINT_OFFSETOF(udp_socket, m_queue_packets) PRINT_OFFSETOF(udp_socket, m_queue_packets)
@ -732,13 +734,17 @@ namespace aux {
PRINT_SIZEOF(http_tracker_connection) PRINT_SIZEOF(http_tracker_connection)
PRINT_SIZEOF(udp_tracker_connection) PRINT_SIZEOF(udp_tracker_connection)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_tracker_connection, m_man) PRINT_OFFSETOF(udp_tracker_connection, m_man)
#endif
PRINT_OFFSETOF(udp_tracker_connection, m_abort) PRINT_OFFSETOF(udp_tracker_connection, m_abort)
PRINT_OFFSETOF(udp_tracker_connection, m_hostname) PRINT_OFFSETOF(udp_tracker_connection, m_hostname)
PRINT_OFFSETOF(udp_tracker_connection, m_target) PRINT_OFFSETOF(udp_tracker_connection, m_target)
PRINT_OFFSETOF(udp_tracker_connection, m_endpoints) PRINT_OFFSETOF(udp_tracker_connection, m_endpoints)
PRINT_OFFSETOF(udp_tracker_connection, m_transaction_id) PRINT_OFFSETOF(udp_tracker_connection, m_transaction_id)
#ifndef _MSC_VER
PRINT_OFFSETOF(udp_tracker_connection, m_ses) PRINT_OFFSETOF(udp_tracker_connection, m_ses)
#endif
PRINT_OFFSETOF(udp_tracker_connection, m_attempts) PRINT_OFFSETOF(udp_tracker_connection, m_attempts)
PRINT_OFFSETOF(udp_tracker_connection, m_state) PRINT_OFFSETOF(udp_tracker_connection, m_state)
PRINT_OFFSETOF(udp_tracker_connection, m_proxy) PRINT_OFFSETOF(udp_tracker_connection, m_proxy)