diff --git a/cpp/include/idevice++/idevice.hpp b/cpp/include/idevice++/idevice.hpp index b00aca9..acc906c 100644 --- a/cpp/include/idevice++/idevice.hpp +++ b/cpp/include/idevice++/idevice.hpp @@ -32,7 +32,9 @@ using IdevicePtr = std::unique_ptr create(IdeviceSocketHandle* socket, const std::string& label); +#if defined(__unix__) || defined(__APPLE__) static Result from_fd(int fd, const std::string& label); +#endif static Result create_tcp(const sockaddr* addr, socklen_t addr_len, const std::string& label); diff --git a/cpp/src/idevice.cpp b/cpp/src/idevice.cpp index 88e0686..88a4080 100644 --- a/cpp/src/idevice.cpp +++ b/cpp/src/idevice.cpp @@ -13,6 +13,7 @@ Result Idevice::create(IdeviceSocketHandle* socket, const std return Ok(Idevice(h)); } +#if defined(__unix__) || defined(__APPLE__) Result Idevice::from_fd(int fd, const std::string& label) { IdeviceHandle* h = nullptr; FfiError e(idevice_from_fd(fd, label.c_str(), &h)); @@ -21,6 +22,7 @@ Result Idevice::from_fd(int fd, const std::string& label) { } return Ok(Idevice(h)); } +#endif Result Idevice::create_tcp(const sockaddr* addr, socklen_t addr_len, const std::string& label) { diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index 358cb15..c317206 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -128,6 +128,7 @@ pub unsafe extern "C" fn idevice_new( /// # Safety /// The socket FD must be valid. /// The pointers must be valid and non-null. +#[cfg(unix)] #[unsafe(no_mangle)] pub unsafe extern "C" fn idevice_from_fd( fd: i32,