From ff3f0a34673a22d439864e5d72038f252d6595e5 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 22 Feb 2024 04:01:34 +0100 Subject: [PATCH] Add test for linking to UIKit --- tests/ui/linkage-attr/uikit-framework.rs | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/ui/linkage-attr/uikit-framework.rs diff --git a/tests/ui/linkage-attr/uikit-framework.rs b/tests/ui/linkage-attr/uikit-framework.rs new file mode 100644 index 00000000000..fca0332384a --- /dev/null +++ b/tests/ui/linkage-attr/uikit-framework.rs @@ -0,0 +1,25 @@ +//! Check that linking to UIKit on platforms where that is available works. +//@ revisions: ios tvos watchos visionos +//@ [ios]only-ios +//@ [tvos]only-tvos +//@ [watchos]only-watchos +//@ [visionos]only-visionos +//@ build-pass + +use std::ffi::{c_char, c_int, c_void}; + +#[link(name = "UIKit", kind = "framework")] +extern "C" { + pub fn UIApplicationMain( + argc: c_int, + argv: *const c_char, + principalClassName: *const c_void, + delegateClassName: *const c_void, + ) -> c_int; +} + +pub fn main() { + unsafe { + UIApplicationMain(0, core::ptr::null(), core::ptr::null(), core::ptr::null()); + } +}