From a96f039fd48175a94518699d154644f717005e79 Mon Sep 17 00:00:00 2001 From: sixtysecrun Date: Mon, 23 Oct 2023 00:17:19 +0200 Subject: [PATCH] Use kIOMasterPortDefault if compiled with SDK<12 Compiling against Apple SDK older than 12.0 ends with errors: error: use of undeclared identifier 'kIOMainPortDefault' That is because `kIOMainPortDefault` was introduced in SDK 12.0 (Monterey) and before that the `kIOMasterPortDefault` should be used. `kIOMasterPortDefault` was deprecated and was removed in SDK 12.0 References: - https://developer.apple.com/documentation/iokit/kiomainportdefault - https://developer.apple.com/documentation/iokit/kiomasterportdefault --- c_src/mac/keyio_mac.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/c_src/mac/keyio_mac.hpp b/c_src/mac/keyio_mac.hpp index d2cc0a45..30883457 100644 --- a/c_src/mac/keyio_mac.hpp +++ b/c_src/mac/keyio_mac.hpp @@ -6,6 +6,12 @@ #include #include #include +#include + +/* The name was changed from "Master" to "Main" in Apple SDK 12.0 (Monterey) */ +#if !defined (MAC_OS_X_VERSION_12_0) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_12_0) + #define kIOMainPortDefault kIOMasterPortDefault +#endif int init_sink(void); int exit_sink(void);