diff --git a/rmw_implementation/src/functions.cpp b/rmw_implementation/src/functions.cpp index e54bdee5d..d2a06fdab 100644 --- a/rmw_implementation/src/functions.cpp +++ b/rmw_implementation/src/functions.cpp @@ -22,11 +22,16 @@ #include #include +#include "rcutils/allocator.h" +#include "rcutils/format_string.h" #include "rcutils/types/string_array.h" #include "Poco/SharedLibrary.h" #include "rmw/error_handling.h" +#include "rmw/names_and_types.h" +#include "rmw/get_service_names_and_types.h" +#include "rmw/get_topic_names_and_types.h" #include "rmw/rmw.h" std::string get_env_var(const char * env_var) @@ -141,7 +146,16 @@ get_symbol(const char * symbol_name) return nullptr; } if (!lib->hasSymbol(symbol_name)) { - RMW_SET_ERROR_MSG("failed to resolve symbol in shared library of rmw implementation"); + rcutils_allocator_t allocator = rcutils_get_default_allocator(); + char * msg = rcutils_format_string( + allocator, + "failed to resolve symbol in shared library '%s'", lib->getPath().c_str()); + if (msg) { + RMW_SET_ERROR_MSG(msg); + allocator.deallocate(msg, allocator.state); + } else { + RMW_SET_ERROR_MSG("failed to allocate memory for error message") + } return nullptr; } return lib->getSymbol(symbol_name); @@ -452,22 +466,26 @@ rmw_wait( rmw_ret_t rmw_get_topic_names_and_types( const rmw_node_t * node, - rmw_topic_names_and_types_t * topic_names_and_types) + rcutils_allocator_t * allocator, + bool no_demangle, + rmw_names_and_types_t * topic_names_and_types) { CALL_SYMBOL( "rmw_get_topic_names_and_types", rmw_ret_t, RMW_RET_ERROR, - ARG_TYPES(const rmw_node_t *, rmw_topic_names_and_types_t *), - ARG_VALUES(node, topic_names_and_types)); + ARG_TYPES(const rmw_node_t *, rcutils_allocator_t *, bool, rmw_names_and_types_t *), + ARG_VALUES(node, allocator, no_demangle, topic_names_and_types)); } rmw_ret_t -rmw_destroy_topic_names_and_types( - rmw_topic_names_and_types_t * topic_names_and_types) +rmw_get_service_names_and_types( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + rmw_names_and_types_t * service_names_and_types) { CALL_SYMBOL( - "rmw_destroy_topic_names_and_types", rmw_ret_t, RMW_RET_ERROR, - ARG_TYPES(rmw_topic_names_and_types_t *), - ARG_VALUES(topic_names_and_types)); + "rmw_get_service_names_and_types", rmw_ret_t, RMW_RET_ERROR, + ARG_TYPES(const rmw_node_t *, rcutils_allocator_t *, rmw_names_and_types_t *), + ARG_VALUES(node, allocator, service_names_and_types)); } rmw_ret_t