From a82996e9fbf42c8944cc8842c547ce560f4bbd04 Mon Sep 17 00:00:00 2001 From: Jesper Stemann Andersen Date: Mon, 16 Dec 2024 16:20:45 +0100 Subject: [PATCH] io/load: Enabled pread implementation for mingw32 (#1706) --- mlx/io/load.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mlx/io/load.cpp b/mlx/io/load.cpp index 22bffd012..d3d40642c 100644 --- a/mlx/io/load.cpp +++ b/mlx/io/load.cpp @@ -6,9 +6,11 @@ #include // Used by pread implementation. +#ifdef _WIN32 +#include +#endif #ifdef _MSC_VER #define NOMINMAX -#include #endif #include "mlx/io/load.h" @@ -106,7 +108,7 @@ Dtype dtype_from_array_protocol(std::string_view t) { "[from_str] Invalid array protocol type-string: " + std::string(t)); } -#ifdef _MSC_VER +#ifdef _WIN32 // There is no pread on Windows, emulate it with ReadFile. int64_t pread(int fd, void* buf, uint64_t size, uint64_t offset) { HANDLE file = reinterpret_cast(_get_osfhandle(fd));