Weak link the hidapi framework on iOS and tvOS

This commit is contained in:
Sam Lantinga
2020-01-31 10:45:04 -08:00
parent 1190343f36
commit 91121ee4bb
2 changed files with 12 additions and 2 deletions

View File

@@ -551,6 +551,16 @@ HIDAPI_JoystickInit(void)
return 0;
}
#if defined(__IPHONEOS__) || defined(__TVOS__)
/* The hidapi framwork is weak-linked on iOS and tvOS */
int HID_API_EXPORT HID_API_CALL hid_init(void) __attribute__((weak_import));
if (hid_init == NULL) {
SDL_SetError("Couldn't initialize hidapi, framework not available");
return -1;
}
#endif /* __IPHONEOS__ || __TVOS__ */
if (hid_init() < 0) {
SDL_SetError("Couldn't initialize hidapi");
return -1;