From 2ab064d2ff5021448ad5ea530c620e3d7ec13e9a Mon Sep 17 00:00:00 2001 From: LiJianying Date: Fri, 20 Nov 2026 08:18:25 +0800 Subject: [PATCH] Export C ABI and protocol handler host symbols with default visibility --- src/capi/accessibility_manager_c.h | 2 ++ src/capi/app_info_c.h | 2 ++ src/capi/application_c.h | 2 ++ src/capi/clipboard_c.h | 2 ++ src/capi/color_c.h | 2 ++ src/capi/common_c.h | 2 ++ src/capi/device_info_c.h | 2 ++ src/capi/dialog_c.h | 2 ++ src/capi/display_c.h | 2 ++ src/capi/display_manager_c.h | 2 ++ src/capi/drag_source_c.h | 2 ++ src/capi/drop_target_c.h | 2 ++ src/capi/event_request_c.h | 2 ++ src/capi/file_dialog_c.h | 2 ++ src/capi/geometry_c.h | 2 ++ src/capi/image_c.h | 2 ++ src/capi/keyboard_c.h | 2 ++ src/capi/keyboard_monitor_c.h | 2 ++ src/capi/launch_at_login_c.h | 2 ++ src/capi/menu_c.h | 2 ++ src/capi/message_dialog_c.h | 2 ++ src/capi/notification_manager_c.h | 2 ++ src/capi/placement_c.h | 2 ++ src/capi/positioning_strategy_c.h | 2 ++ src/capi/preferences_c.h | 2 ++ src/capi/protocol_handler_c.h | 2 ++ src/capi/secure_storage_c.h | 2 ++ src/capi/shortcut_c.h | 2 ++ src/capi/shortcut_manager_c.h | 2 ++ src/capi/string_utils_c.h | 2 ++ src/capi/tray_icon_c.h | 2 ++ src/capi/tray_manager_c.h | 2 ++ src/capi/url_opener_c.h | 2 ++ src/capi/view_c.h | 2 ++ src/capi/window_c.h | 2 ++ src/capi/window_drag_session_c.h | 2 ++ src/capi/window_manager_c.h | 2 ++ src/capi/window_shadow_c.h | 2 ++ src/capi/window_shape_c.h | 2 ++ src/protocol_handler_dispatch.h | 12 ++++++++++-- 40 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/capi/accessibility_manager_c.h b/src/capi/accessibility_manager_c.h index aa9660a8..adca043d 100644 --- a/src/capi/accessibility_manager_c.h +++ b/src/capi/accessibility_manager_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/app_info_c.h b/src/capi/app_info_c.h index ebfd2b0d..f57c5058 100644 --- a/src/capi/app_info_c.h +++ b/src/capi/app_info_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/application_c.h b/src/capi/application_c.h index 7f0d1564..bf90796f 100644 --- a/src/capi/application_c.h +++ b/src/capi/application_c.h @@ -17,6 +17,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/clipboard_c.h b/src/capi/clipboard_c.h index 96b85446..12a445d4 100644 --- a/src/capi/clipboard_c.h +++ b/src/capi/clipboard_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_image_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/color_c.h b/src/capi/color_c.h index 64b1c5c6..b77b7d16 100644 --- a/src/capi/color_c.h +++ b/src/capi/color_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/common_c.h b/src/capi/common_c.h index 5f163cd7..43e9dcd6 100644 --- a/src/capi/common_c.h +++ b/src/capi/common_c.h @@ -8,6 +8,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/device_info_c.h b/src/capi/device_info_c.h index e8c242ff..bf49afb1 100644 --- a/src/capi/device_info_c.h +++ b/src/capi/device_info_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/dialog_c.h b/src/capi/dialog_c.h index 63c5c0f7..18065a26 100644 --- a/src/capi/dialog_c.h +++ b/src/capi/dialog_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/display_c.h b/src/capi/display_c.h index fe0ff622..4fcc1461 100644 --- a/src/capi/display_c.h +++ b/src/capi/display_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/display_manager_c.h b/src/capi/display_manager_c.h index dae82dd3..d1df99b9 100644 --- a/src/capi/display_manager_c.h +++ b/src/capi/display_manager_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_display_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/drag_source_c.h b/src/capi/drag_source_c.h index 4f047440..73473a12 100644 --- a/src/capi/drag_source_c.h +++ b/src/capi/drag_source_c.h @@ -17,6 +17,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/drop_target_c.h b/src/capi/drop_target_c.h index 2f67a6ac..e6a3bf4e 100644 --- a/src/capi/drop_target_c.h +++ b/src/capi/drop_target_c.h @@ -15,6 +15,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/event_request_c.h b/src/capi/event_request_c.h index b2802473..a60b756b 100644 --- a/src/capi/event_request_c.h +++ b/src/capi/event_request_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/file_dialog_c.h b/src/capi/file_dialog_c.h index a7699f16..d15eaeae 100644 --- a/src/capi/file_dialog_c.h +++ b/src/capi/file_dialog_c.h @@ -15,6 +15,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/geometry_c.h b/src/capi/geometry_c.h index 10e850ef..e9f5e5cf 100644 --- a/src/capi/geometry_c.h +++ b/src/capi/geometry_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/image_c.h b/src/capi/image_c.h index 04f0a891..e53958d0 100644 --- a/src/capi/image_c.h +++ b/src/capi/image_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/keyboard_c.h b/src/capi/keyboard_c.h index 7c22be3b..ee86cc3f 100644 --- a/src/capi/keyboard_c.h +++ b/src/capi/keyboard_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/keyboard_monitor_c.h b/src/capi/keyboard_monitor_c.h index 1fe8e8b5..36ce8631 100644 --- a/src/capi/keyboard_monitor_c.h +++ b/src/capi/keyboard_monitor_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/launch_at_login_c.h b/src/capi/launch_at_login_c.h index 8b23f804..10982a4c 100644 --- a/src/capi/launch_at_login_c.h +++ b/src/capi/launch_at_login_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/menu_c.h b/src/capi/menu_c.h index bfc2604d..70821be6 100644 --- a/src/capi/menu_c.h +++ b/src/capi/menu_c.h @@ -17,6 +17,8 @@ typedef uint64_t native_positioning_strategy_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/message_dialog_c.h b/src/capi/message_dialog_c.h index 50e69049..03f9d73d 100644 --- a/src/capi/message_dialog_c.h +++ b/src/capi/message_dialog_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/notification_manager_c.h b/src/capi/notification_manager_c.h index 427186ac..721829c5 100644 --- a/src/capi/notification_manager_c.h +++ b/src/capi/notification_manager_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/placement_c.h b/src/capi/placement_c.h index deaaa049..f6790c3b 100644 --- a/src/capi/placement_c.h +++ b/src/capi/placement_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/positioning_strategy_c.h b/src/capi/positioning_strategy_c.h index 13fdf6f5..bcc47f76 100644 --- a/src/capi/positioning_strategy_c.h +++ b/src/capi/positioning_strategy_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/preferences_c.h b/src/capi/preferences_c.h index 25ddc6c8..da1b4208 100644 --- a/src/capi/preferences_c.h +++ b/src/capi/preferences_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/protocol_handler_c.h b/src/capi/protocol_handler_c.h index af427896..80b4de8f 100644 --- a/src/capi/protocol_handler_c.h +++ b/src/capi/protocol_handler_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/secure_storage_c.h b/src/capi/secure_storage_c.h index d1a006ed..43cb1e7e 100644 --- a/src/capi/secure_storage_c.h +++ b/src/capi/secure_storage_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/shortcut_c.h b/src/capi/shortcut_c.h index a9c35054..c75ea312 100644 --- a/src/capi/shortcut_c.h +++ b/src/capi/shortcut_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/shortcut_manager_c.h b/src/capi/shortcut_manager_c.h index e7ca29ea..df2c40d7 100644 --- a/src/capi/shortcut_manager_c.h +++ b/src/capi/shortcut_manager_c.h @@ -13,6 +13,8 @@ typedef uint64_t native_shortcut_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/string_utils_c.h b/src/capi/string_utils_c.h index 19410ba8..37acfd57 100644 --- a/src/capi/string_utils_c.h +++ b/src/capi/string_utils_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/tray_icon_c.h b/src/capi/tray_icon_c.h index d35e21fe..66f1faf4 100644 --- a/src/capi/tray_icon_c.h +++ b/src/capi/tray_icon_c.h @@ -18,6 +18,8 @@ typedef uint64_t native_view_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/tray_manager_c.h b/src/capi/tray_manager_c.h index 6f6964a5..930ca3cb 100644 --- a/src/capi/tray_manager_c.h +++ b/src/capi/tray_manager_c.h @@ -13,6 +13,8 @@ typedef uint64_t native_tray_icon_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/url_opener_c.h b/src/capi/url_opener_c.h index d79cf269..f202ec81 100644 --- a/src/capi/url_opener_c.h +++ b/src/capi/url_opener_c.h @@ -10,6 +10,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/view_c.h b/src/capi/view_c.h index 10c23f9f..93634970 100644 --- a/src/capi/view_c.h +++ b/src/capi/view_c.h @@ -17,6 +17,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/window_c.h b/src/capi/window_c.h index f1cc7820..f8a310e9 100644 --- a/src/capi/window_c.h +++ b/src/capi/window_c.h @@ -21,6 +21,8 @@ typedef uint64_t native_window_shape_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/window_drag_session_c.h b/src/capi/window_drag_session_c.h index b2993346..72f4593d 100644 --- a/src/capi/window_drag_session_c.h +++ b/src/capi/window_drag_session_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/window_manager_c.h b/src/capi/window_manager_c.h index 5cf71fc5..0d76a64c 100644 --- a/src/capi/window_manager_c.h +++ b/src/capi/window_manager_c.h @@ -14,6 +14,8 @@ typedef uint64_t native_window_t; #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/window_shadow_c.h b/src/capi/window_shadow_c.h index d3ed54c2..bd99dab4 100644 --- a/src/capi/window_shadow_c.h +++ b/src/capi/window_shadow_c.h @@ -12,6 +12,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/capi/window_shape_c.h b/src/capi/window_shape_c.h index 81c447bb..c6b6e189 100644 --- a/src/capi/window_shape_c.h +++ b/src/capi/window_shape_c.h @@ -11,6 +11,8 @@ #if _WIN32 #define FFI_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define FFI_PLUGIN_EXPORT __attribute__((visibility("default"))) #else #define FFI_PLUGIN_EXPORT #endif diff --git a/src/protocol_handler_dispatch.h b/src/protocol_handler_dispatch.h index 787650dc..95491b79 100644 --- a/src/protocol_handler_dispatch.h +++ b/src/protocol_handler_dispatch.h @@ -31,12 +31,20 @@ class ProtocolHandlerDispatch { } // namespace nativeapi::detail +#if _WIN32 +#define NATIVEAPI_HOST_EXPORT __declspec(dllexport) +#elif defined(__GNUC__) || defined(__clang__) +#define NATIVEAPI_HOST_EXPORT __attribute__((visibility("default"))) +#else +#define NATIVEAPI_HOST_EXPORT +#endif + // Host bridge for hosts that cannot link core but load its shared library, i.e. // the leanflutter protocol_handler Flutter plugin (dlsym on Apple, JNI on Android). // The names and signatures are a stable contract; see specs/protocol-handler.md. extern "C" { // Creates the handler (starting native capture) and marks the host attached. -void nativeapi_protocol_handler_host_attach(void); +NATIVEAPI_HOST_EXPORT void nativeapi_protocol_handler_host_attach(void); // url is UTF-8; is_launch is non-zero for the URL that launched the process. -void nativeapi_protocol_handler_host_deliver(const char* url, int is_launch); +NATIVEAPI_HOST_EXPORT void nativeapi_protocol_handler_host_deliver(const char* url, int is_launch); }