Global Hotkey Declare Failure

I want a global macOS Keyboard Shortcut without using MBS. I tried the Hotkey Demo by @Thomas_Tempelmann from here: Global Hotkey Declare

When I Run or Build the project, I’ll get this error:

Linking Executable
Undefined symbols for architecture x86_64:

"_NewEventHandlerUPP", referenced from:
_Hotkeys.RegisterForEvents in Hotkeys.o
ld: symbol(s) not found for architecture x86_64

Any hints how to fix this? Or does Apple have removed the APIs?

NewEventHandlerUPP is now more.
You can remove it.

Thanks for your prompt reply. Just removing does not seem to work, as it is used in the InstallEventHandler call. Is there a replacement? Sorry, I’ve no experience with Xojo and macOS Frameworks.

...
Declare Function NewEventHandlerUPP Lib CarbonLib (userRoutine As Ptr) As Ptr
...
err = InstallEventHandler(eventTarget, NewEventHandlerUPP (AddressOf HandleEvent), 1, eventList, Nil, Nil)
...

I have updated the demo project. Works with Xojo 2021r3.1

http://files.tempel.org/RB/Hotkey%20Demo%20(Mac%20only).zip

Note that it’s not able to show the typed keys any more. There are other ways to accomplish that but I have no time to work on that now.

Hi Thomas, thanks a lot for updating the project so quickly. It works as expected. I don’t need the other function of the demo.