Function rcutils_get_zero_initialized_shared_library
Defined in File shared_library.h
Function Documentation
-
rcutils_shared_library_t rcutils_get_zero_initialized_shared_library(void)
Return an empty shared library struct.
This function returns an empty and zero initialized shared library struct.
Example:
// Do not do this: // rcutils_shared_library_t foo; // rcutils_ret_t ret = rcutils_load_shared_library( // &foo, // "library_name", // rcutils_get_default_allocator()); // undefined behavior! // or // rcutils_ret_t ret = rcutils_unload_shared_library(&foo); // undefined behavior! // Do this instead: rcutils_shared_library_t bar = rcutils_get_zero_initialized_shared_library(); rcutils_load_shared_library(&bar, "library_name", rcutils_get_default_allocator()); // ok void * symbol = rcutils_get_symbol(&bar, "bazinga"); // ok bool is_bazinga_symbol = rcutils_has_symbol(&bar, "bazinga"); // ok rcutils_ret_t ret = rcutils_unload_shared_library(&bar); // ok if (ret != RCUTILS_RET_ERROR) { // error handling }