Skip to content

Commit

Permalink
Use kIOMasterPortDefault if compiled with SDK<12
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sixtysecrun authored and slotThe committed Oct 25, 2023
1 parent 3482067 commit a96f039
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions c_src/mac/keyio_mac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
#include <map>
#include <iostream>
#include <mach/mach_error.h>
#include <AvailabilityMacros.h>

/* 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);
Expand Down

0 comments on commit a96f039

Please sign in to comment.