From 2c0e35d9d159f6cb656475bdccbb36b66bf40343 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Tue, 30 Oct 2018 10:39:02 -0700 Subject: [PATCH] [rcl_action] Add missing visibilty control definitions (#315) --- rcl_action/include/rcl_action/action_client.h | 32 +++++------ rcl_action/include/rcl_action/action_server.h | 42 +++++++------- rcl_action/include/rcl_action/goal_handle.h | 18 +++--- .../include/rcl_action/goal_state_machine.h | 4 +- rcl_action/include/rcl_action/types.h | 23 ++++---- .../include/rcl_action/visibility_control.h | 56 +++++++++++++++++++ rcl_action/include/rcl_action/wait.h | 13 +++-- 7 files changed, 123 insertions(+), 65 deletions(-) create mode 100644 rcl_action/include/rcl_action/visibility_control.h diff --git a/rcl_action/include/rcl_action/action_client.h b/rcl_action/include/rcl_action/action_client.h index ae2d0bc..37ef690 100644 --- a/rcl_action/include/rcl_action/action_client.h +++ b/rcl_action/include/rcl_action/action_client.h @@ -25,9 +25,9 @@ extern "C" typedef struct rosidl_action_type_support_t rosidl_action_type_support_t; #include "rcl_action/types.h" +#include "rcl_action/visibility_control.h" #include "rcl/macros.h" #include "rcl/node.h" -#include "rcl/visibility_control.h" /// Internal action client implementation struct. @@ -58,7 +58,7 @@ typedef struct rcl_action_client_options_t * Should be called to get a null rcl_action_client_t before passing to * rcl_action_client_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_client_t rcl_action_get_zero_initialized_client(void); @@ -171,7 +171,7 @@ rcl_action_get_zero_initialized_client(void); * \return `RCL_RET_ACTION_NAME_INVALID` if the given action name is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_client_init( @@ -211,7 +211,7 @@ rcl_action_client_init( * \return `RCL_RET_NODE_INVALID` if the node is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_client_fini(rcl_action_client_t * action_client, rcl_node_t * node); @@ -227,7 +227,7 @@ rcl_action_client_fini(rcl_action_client_t * action_client, rcl_node_t * node); * - status_topic_qos = rcl_action_qos_profile_status_default; * - allocator = rcl_get_default_allocator() */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_client_options_t rcl_action_client_get_default_options(void); @@ -272,7 +272,7 @@ rcl_action_client_get_default_options(void); * \return `RCL_RET_ACTION_CLIENT_INVALID` if the client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_goal_request( @@ -317,7 +317,7 @@ rcl_action_send_goal_request( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_goal_response( @@ -367,7 +367,7 @@ rcl_action_take_goal_response( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_feedback( @@ -413,7 +413,7 @@ rcl_action_take_feedback( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_status( @@ -460,7 +460,7 @@ rcl_action_take_status( * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_result_request( @@ -512,7 +512,7 @@ rcl_action_send_result_request( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_result_response( @@ -554,7 +554,7 @@ rcl_action_take_result_response( * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_cancel_request( @@ -600,7 +600,7 @@ rcl_action_send_cancel_request( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_cancel_response( @@ -629,7 +629,7 @@ rcl_action_take_cancel_response( * \param[in] action_client the pointer to the action client * \return name string if successful, otherwise `NULL` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED const char * rcl_action_client_get_action_name(const rcl_action_client_t * action_client); @@ -656,7 +656,7 @@ rcl_action_client_get_action_name(const rcl_action_client_t * action_client); * \param[in] action_client pointer to the action client * \return options struct if successful, otherwise `NULL` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED const rcl_action_client_options_t * rcl_action_client_get_options(const rcl_action_client_t * action_client); @@ -680,7 +680,7 @@ rcl_action_client_get_options(const rcl_action_client_t * action_client); * \param[in] error_msg_allocator a valid allocator or `NULL` * \return `true` if `action_client` is valid, otherwise `false` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC bool rcl_action_client_is_valid( const rcl_action_client_t * action_client, diff --git a/rcl_action/include/rcl_action/action_server.h b/rcl_action/include/rcl_action/action_server.h index b6f2d9d..80c14e1 100644 --- a/rcl_action/include/rcl_action/action_server.h +++ b/rcl_action/include/rcl_action/action_server.h @@ -26,10 +26,10 @@ typedef struct rosidl_action_type_support_t rosidl_action_type_support_t; #include "rcl_action/goal_handle.h" #include "rcl_action/types.h" +#include "rcl_action/visibility_control.h" #include "rcl/macros.h" #include "rcl/node.h" #include "rcl/time.h" -#include "rcl/visibility_control.h" /// Internal rcl_action implementation struct. @@ -62,7 +62,7 @@ typedef struct rcl_action_server_options_t * Should be called to get a null rcl_action_server_t before passing to * rcl_action_server_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_server_t rcl_action_get_zero_initialized_server(void); @@ -164,7 +164,7 @@ rcl_action_get_zero_initialized_server(void); * \return `RCL_RET_ACTION_NAME_INVALID` if the given action name is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_server_init( @@ -201,7 +201,7 @@ rcl_action_server_init( * \return `RCL_RET_NODE_INVALID` if the node is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_server_fini(rcl_action_server_t * action_server, rcl_node_t * node); @@ -218,7 +218,7 @@ rcl_action_server_fini(rcl_action_server_t * action_server, rcl_node_t * node); * - allocator = rcl_get_default_allocator() - result_timeout = 9e+11; // 15 minutes */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_server_options_t rcl_action_server_get_default_options(void); @@ -264,7 +264,7 @@ rcl_action_server_get_default_options(void); * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_goal_request( @@ -310,7 +310,7 @@ rcl_action_take_goal_request( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_goal_response( @@ -364,7 +364,7 @@ rcl_action_send_goal_response( * \return a pointer to a new goal handle representing the accepted goal, or * \return `NULL` if a failure occured. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_goal_handle_t * rcl_action_accept_new_goal( @@ -413,7 +413,7 @@ rcl_action_accept_new_goal( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. * */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_publish_feedback( @@ -440,7 +440,7 @@ rcl_action_publish_feedback( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_get_goal_status_array( @@ -470,7 +470,7 @@ rcl_action_get_goal_status_array( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_publish_status( @@ -508,7 +508,7 @@ rcl_action_publish_status( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_result_request( @@ -542,7 +542,7 @@ rcl_action_take_result_request( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_result_response( @@ -571,7 +571,7 @@ rcl_action_send_result_response( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_clear_expired_goals( @@ -612,7 +612,7 @@ rcl_action_clear_expired_goals( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_take_cancel_request( @@ -655,7 +655,7 @@ rcl_action_take_cancel_request( * in the middleware, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_process_cancel_request( @@ -682,7 +682,7 @@ rcl_action_process_cancel_request( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_send_cancel_response( @@ -711,7 +711,7 @@ rcl_action_send_cancel_response( * \param[in] action_server the pointer to the action server * \return name string if successful, otherwise `NULL` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED const char * rcl_action_server_get_action_name(const rcl_action_server_t * action_server); @@ -738,7 +738,7 @@ rcl_action_server_get_action_name(const rcl_action_server_t * action_server); * \param[in] action_server pointer to the action server * \return options struct if successful, otherwise `NULL` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED const rcl_action_server_options_t * rcl_action_server_get_options(const rcl_action_server_t * action_server); @@ -775,7 +775,7 @@ rcl_action_server_get_options(const rcl_action_server_t * action_server); * not set otherwise. * \return pointer to an array goal handles if successful, otherwise `NULL` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED const rcl_action_goal_handle_t * rcl_action_server_get_goal_handles( @@ -802,7 +802,7 @@ rcl_action_server_get_goal_handles( * \param[in] error_msg_allocator a valid allocator or `NULL` * \return `true` if `action_server` is valid, otherwise `false` */ -RCL_PUBLIC +RCL_ACTION_PUBLIC bool rcl_action_server_is_valid( const rcl_action_server_t * action_server, diff --git a/rcl_action/include/rcl_action/goal_handle.h b/rcl_action/include/rcl_action/goal_handle.h index 179cd87..2ef5cc4 100644 --- a/rcl_action/include/rcl_action/goal_handle.h +++ b/rcl_action/include/rcl_action/goal_handle.h @@ -22,7 +22,7 @@ extern "C" #include "rcl_action/goal_state_machine.h" #include "rcl_action/types.h" -#include "rcl/visibility_control.h" +#include "rcl_action/visibility_control.h" // Forward declare typedef struct rcl_action_server_t rcl_action_server_t; @@ -41,7 +41,7 @@ typedef struct rcl_action_goal_handle_t * Should be called to get a null rcl_action_goal_handle_t before passing to * rcl_action_goal_handle_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_goal_handle_t rcl_action_get_zero_initialized_goal_handle(void); @@ -101,7 +101,7 @@ rcl_action_get_zero_initialized_goal_handle(void); * \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_handle_init( @@ -134,7 +134,7 @@ rcl_action_goal_handle_init( * \return `RCL_RET_ACTION_GOAL_HANDLE_INVALID` if the goal handle is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_handle_fini(rcl_action_goal_handle_t * goal_handle); @@ -158,7 +158,7 @@ rcl_action_goal_handle_fini(rcl_action_goal_handle_t * goal_handle); * \return `RCL_RET_ACTION_GOAL_HANDLE_INVALID` if the goal handle is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_update_goal_state( @@ -183,7 +183,7 @@ rcl_action_update_goal_state( * \return `RCL_RET_ACTION_GOAL_HANDLE_INVALID` if the goal handle is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_handle_get_info( @@ -208,7 +208,7 @@ rcl_action_goal_handle_get_info( * \return `RCL_RET_ACTION_GOAL_HANDLE_INVALID` if the goal handle is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_handle_get_status( @@ -237,7 +237,7 @@ rcl_action_goal_handle_get_status( * \return `false` otherwise, also * \return `false` if the goal handle pointer is invalid or the allocator is invalid */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED bool rcl_action_goal_handle_is_active( @@ -270,7 +270,7 @@ rcl_action_goal_handle_is_active( * \return `true` if the goal handle is valid, `false` otherwise, also * \return `false` if the allocator is invalid */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED bool rcl_action_goal_handle_is_valid( diff --git a/rcl_action/include/rcl_action/goal_state_machine.h b/rcl_action/include/rcl_action/goal_state_machine.h index cd91b94..3420d07 100644 --- a/rcl_action/include/rcl_action/goal_state_machine.h +++ b/rcl_action/include/rcl_action/goal_state_machine.h @@ -21,7 +21,7 @@ extern "C" #endif #include "rcl_action/types.h" -#include "rcl/visibility_control.h" +#include "rcl_action/visibility_control.h" typedef rcl_action_goal_state_t @@ -110,7 +110,7 @@ rcl_action_goal_event_handler * \return the next goal state if the transition is valid, or * \return `GOAl_STATE_UNKNOWN` if the transition is invalid or an error occured */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED inline rcl_action_goal_state_t rcl_action_transition_goal_state( diff --git a/rcl_action/include/rcl_action/types.h b/rcl_action/include/rcl_action/types.h index 4c24b1b..ff0be45 100644 --- a/rcl_action/include/rcl_action/types.h +++ b/rcl_action/include/rcl_action/types.h @@ -20,6 +20,8 @@ extern "C" { #endif +#include "rcl_action/visibility_control.h" + #include "action_msgs/msg/goal_info.h" #include "action_msgs/msg/goal_status.h" #include "action_msgs/msg/goal_status_array.h" @@ -27,7 +29,6 @@ extern "C" #include "rcl/macros.h" #include "rcl/types.h" -#include "rcl/visibility_control.h" // rcl action specific ret codes in 2XXX @@ -89,7 +90,7 @@ typedef enum rcl_action_goal_event_t * Should be called to get a null rcl_action_goal_info_t before passing to * rcl_action_goal_info_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_goal_info_t rcl_action_get_zero_initialized_goal_info(void); @@ -133,7 +134,7 @@ rcl_action_get_zero_initialized_goal_info(void); * \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_info_init( @@ -160,7 +161,7 @@ rcl_action_goal_info_init( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_goal_info_fini( @@ -172,7 +173,7 @@ rcl_action_goal_info_fini( * Should be called to get a null rcl_action_goal_status_array_t before passing to * rcl_action_server_get_goal_status_array(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_goal_status_array_t rcl_action_get_zero_initialized_goal_status_array(void); @@ -183,7 +184,7 @@ rcl_action_get_zero_initialized_goal_status_array(void); * * rcl_action_cancel_request_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_cancel_request_t rcl_action_get_zero_initialized_cancel_request(void); @@ -229,7 +230,7 @@ rcl_action_get_zero_initialized_cancel_request(void); * \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_cancel_request_init( @@ -256,7 +257,7 @@ rcl_action_cancel_request_init( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_cancel_request_fini( @@ -268,7 +269,7 @@ rcl_action_cancel_request_fini( * Should be called to get a null rcl_action_cancel_response_t before passing to * rcl_action_cancel_response_init(). */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_action_cancel_response_t rcl_action_get_zero_initialized_cancel_response(void); @@ -315,7 +316,7 @@ rcl_action_get_zero_initialized_cancel_response(void); * \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_cancel_response_init( @@ -342,7 +343,7 @@ rcl_action_cancel_response_init( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_cancel_response_fini( diff --git a/rcl_action/include/rcl_action/visibility_control.h b/rcl_action/include/rcl_action/visibility_control.h new file mode 100644 index 0000000..af43532 --- /dev/null +++ b/rcl_action/include/rcl_action/visibility_control.h @@ -0,0 +1,56 @@ +// Copyright 2016 Open Source Robotics Foundation, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* This header must be included by all rclcpp headers which declare symbols + * which are defined in the rclcpp library. When not building the rclcpp + * library, i.e. when using the headers in other package's code, the contents + * of this header change the visibility of certain symbols which the rclcpp + * library cannot have, but the consuming code must have inorder to link. + */ + +#ifndef RCL_ACTION__VISIBILITY_CONTROL_H_ +#define RCL_ACTION__VISIBILITY_CONTROL_H_ + +// This logic was borrowed (then namespaced) from the examples on the gcc wiki: +// https://gcc.gnu.org/wiki/Visibility + +#if defined _WIN32 || defined __CYGWIN__ + #ifdef __GNUC__ + #define RCL_ACTION_EXPORT __attribute__ ((dllexport)) + #define RCL_ACTION_IMPORT __attribute__ ((dllimport)) + #else + #define RCL_ACTION_EXPORT __declspec(dllexport) + #define RCL_ACTION_IMPORT __declspec(dllimport) + #endif + #ifdef RCL_ACTION_BUILDING_DLL + #define RCL_ACTION_PUBLIC RCL_ACTION_EXPORT + #else + #define RCL_ACTION_PUBLIC RCL_ACTION_IMPORT + #endif + #define RCL_ACTION_PUBLIC_TYPE RCL_ACTION_PUBLIC + #define RCL_ACTION_LOCAL +#else + #define RCL_ACTION_EXPORT __attribute__ ((visibility("default"))) + #define RCL_ACTION_IMPORT + #if __GNUC__ >= 4 + #define RCL_ACTION_PUBLIC __attribute__ ((visibility("default"))) + #define RCL_ACTION_LOCAL __attribute__ ((visibility("hidden"))) + #else + #define RCL_ACTION_PUBLIC + #define RCL_ACTION_LOCAL + #endif + #define RCL_ACTION_PUBLIC_TYPE +#endif + +#endif // RCL_ACTION__VISIBILITY_CONTROL_H_ diff --git a/rcl_action/include/rcl_action/wait.h b/rcl_action/include/rcl_action/wait.h index 5ec5fa7..95ebc87 100644 --- a/rcl_action/include/rcl_action/wait.h +++ b/rcl_action/include/rcl_action/wait.h @@ -22,6 +22,7 @@ extern "C" #include "rcl_action/action_client.h" #include "rcl_action/action_server.h" +#include "rcl_action/visibility_control.h" #include "rcl/wait.h" @@ -54,7 +55,7 @@ extern "C" * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_wait_set_add_action_client( @@ -86,7 +87,7 @@ rcl_action_wait_set_add_action_client( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_wait_set_add_action_server( @@ -122,7 +123,7 @@ rcl_action_wait_set_add_action_server( * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_client_wait_set_get_num_entities( @@ -162,7 +163,7 @@ rcl_action_client_wait_set_get_num_entities( * \return `RCL_RET_ACTION_SERVER_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_server_wait_set_get_num_entities( @@ -203,7 +204,7 @@ rcl_action_server_wait_set_get_num_entities( * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action client is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_client_wait_set_get_entities_ready( @@ -240,7 +241,7 @@ rcl_action_client_wait_set_get_entities_ready( * \return `RCL_RET_ACTION_CLIENT_INVALID` if the action server is invalid, or * \return `RCL_RET_ERROR` if an unspecified error occurs. */ -RCL_PUBLIC +RCL_ACTION_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_action_server_wait_set_get_entities_ready(