From a2f899fb8ad270757c02261cdf038e7ac3238de2 Mon Sep 17 00:00:00 2001 From: John Blomberg Date: Mon, 23 Oct 2023 16:21:11 +0200 Subject: [PATCH] Fix python binding compilation for Windows When building using MSVC the CL compiler will fail with the following error: fasttext_pybind.cc(171): error C2065: 'ssize_t': undeclared identifier It seems like ssize_t is a non-standard posix extension which is not defined in Windows, I added a typedef to the windows version SSIZE_T to fix it. --- python/fasttext_module/fasttext/pybind/fasttext_pybind.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/fasttext_module/fasttext/pybind/fasttext_pybind.cc b/python/fasttext_module/fasttext/pybind/fasttext_pybind.cc index 97909059b..38c2d6a57 100644 --- a/python/fasttext_module/fasttext/pybind/fasttext_pybind.cc +++ b/python/fasttext_module/fasttext/pybind/fasttext_pybind.cc @@ -5,6 +5,10 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif #include #include