Carbon Framework in macOS builds

I built SDL2-2.0.12 on MacOS, using the bundled Xcode project.

When I try to use it in my app, I notice that I need to link against the Carbon Framework.

This surprises me, as Carbon has been deprecated, since 2012 no less.

The SDL2 bundled examples also link against Carbon (and Cocoa.) When I remove the Carbon framework, I get undefined symbols:

Undefined symbols for architecture x86_64:
  "_KBGetLayoutType", referenced from:
      _Cocoa_HandleKeyEvent in libSDL2.a(SDL_cocoakeyboard.o)
  "_LMGetKbdType", referenced from:
      _UpdateKeymap in libSDL2.a(SDL_cocoakeyboard.o)
      _Cocoa_HandleKeyEvent in libSDL2.a(SDL_cocoakeyboard.o)
  "_TISCopyCurrentKeyboardLayoutInputSource", referenced from:
      _UpdateKeymap in libSDL2.a(SDL_cocoakeyboard.o)
  "_TISGetInputSourceProperty", referenced from:
      _UpdateKeymap in libSDL2.a(SDL_cocoakeyboard.o)
  "_kTISPropertyUnicodeKeyLayoutData", referenced from:
      _UpdateKeymap in libSDL2.a(SDL_cocoakeyboard.o)

Should SDL2 be using symbols from Carbon? Are there no replacements for this in the more modern Cocoa framework?

UPDATE: I noticed there was already talk in 2012 of removing Carbon calls from SDL2. But I guess they managed to survive till this day.

Yeah, the pieces that are still in there either have no good replacements or are so dark and esoteric that no one feels confident in removing them.

(at least, this was true last I checked, which wasn’t recently.)

Fwiw, though, all those APIs are still available, even on the Apple Silicon developer kits.

1 Like