Skip to content

Commit b2050f3

Browse files
committed
feat: add cygwin support
1 parent 6bdd37f commit b2050f3

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/os/unix/consts.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ mod posix {
8888
target_os = "redox",
8989
target_os = "nto",
9090
target_os = "hurd",
91+
target_os = "cygwin",
9192
))] {
9293
pub(super) const RTLD_LAZY: c_int = 1;
9394
} else {
@@ -127,6 +128,7 @@ mod posix {
127128
target_os = "redox",
128129
target_os = "nto",
129130
target_os = "hurd",
131+
target_os = "cygwin",
130132
))] {
131133
pub(super) const RTLD_NOW: c_int = 2;
132134
} else if #[cfg(all(target_os = "android",target_pointer_width = "32"))] {
@@ -150,6 +152,7 @@ mod posix {
150152
target_env = "uclibc",
151153
all(target_os = "linux", target_arch = "mips"),
152154
all(target_os = "linux", target_arch = "mips64"),
155+
target_os = "cygwin",
153156
))] {
154157
pub(super) const RTLD_GLOBAL: c_int = 4;
155158
} else if #[cfg(any(
@@ -224,6 +227,7 @@ mod posix {
224227
target_os = "fuchsia",
225228
target_os = "redox",
226229
target_os = "hurd",
230+
target_os = "cygwin",
227231
))] {
228232
pub(super) const RTLD_LOCAL: c_int = 0;
229233
} else {

src/os/unix/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ impl Library {
278278
target_os = "solaris",
279279
target_os = "illumos",
280280
target_os = "redox",
281-
target_os = "fuchsia"
281+
target_os = "fuchsia",
282+
target_os = "cygwin",
282283
))] {
283284
self.get_singlethreaded(symbol)
284285
} else {

tests/functions.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ fn test_static_ptr() {
191191
// the target. Especially since it is very unlikely to be fixed given the state of support its
192192
// support.
193193
#[cfg(not(all(target_arch = "x86", target_os = "windows", target_env = "gnu")))]
194+
// Cygwin returns errors on `close`.
195+
#[cfg(not(target_os = "cygwin"))]
194196
fn manual_close_many_times() {
195197
make_helpers();
196198
let join_handles: Vec<_> = (0..16)
@@ -224,6 +226,8 @@ fn library_this_get() {
224226
.get::<unsafe extern "C" fn()>(b"test_identity_u32")
225227
.is_err());
226228
// Something obscure from libc...
229+
// Cygwin behaves like Windows so ignore it.
230+
#[cfg(not(target_os = "cygwin"))]
227231
assert!(this.get::<unsafe extern "C" fn()>(b"freopen").is_ok());
228232
}
229233
}

tests/library_filename.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate libloading;
22
use libloading::library_filename;
33
use std::path::Path;
44

5-
#[cfg(target_os = "windows")]
5+
#[cfg(any(target_os = "windows", target_os = "cygwin"))]
66
const EXPECTED: &str = "audioengine.dll";
77
#[cfg(target_os = "linux")]
88
const EXPECTED: &str = "libaudioengine.so";

0 commit comments

Comments
 (0)