Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use winapi on windows, update windows build instructions #1

Merged
merged 1 commit into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ mio = { version = "0.6", optional = true }
tokio-core = { version = "0.1", optional = true }
futures = { version = "0.1", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.2"

[dev-dependencies]
tempdir = "0.3"

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ See examples for usage.
## Windows

Install [WinPcap](http://www.winpcap.org/install/default.htm).

Place wpcap.dll in your `C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\` directory on 64 bit
or `C:\Rust\bin\rustlib\i686-pc-windows-gnu\lib\` on 32 bit.
Download the WinPcap [Developer's Pack](https://www.winpcap.org/devel.htm).
Add the `/Lib` or `/Lib/x64` folder to your `LIB` environment variable.

## Linux

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ extern crate mio;
extern crate futures;
#[cfg(feature = "tokio")]
extern crate tokio_core;
#[cfg(target_os = "windows")]
extern crate winapi;

use unique::Unique;

Expand Down
6 changes: 5 additions & 1 deletion src/raw.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#![allow(dead_code)]
#![allow(non_camel_case_types)]

use libc::{c_int, c_uint, c_char, c_uchar, c_ushort, sockaddr, timeval, FILE};
use libc::{c_int, c_uint, c_char, c_uchar, c_ushort, timeval, FILE};
#[cfg(target_os = "windows")]
use winapi::ws2def::SOCKADDR as sockaddr;
#[cfg(not(target_os = "windows"))]
use libc::sockaddr;

#[repr(C)]
#[derive(Copy, Clone)]
Expand Down