How does the ROS2 DDS Shared Library get loaded in rclpy?
I'm trying to understand how the DDS shared library is loaded by rclpy->rcl->rmw, and have hit a stumbling point:
It appears that rclpy_init() calls rcl_init() which calles rmw_init() and that function will load the shared library.
My confusion is that two lines above the call to rcl_init(); It appears that rcl_init_options_init() calls rmw_init_options_init() which is located in the shared library, that shouldn't be loaded yet...
What am I missing here?
I think I confirmed that the shared library is loaded before reaching rmw_init by placing some log_info() statements in rmw_fastrtps_shared_cpp / rmw_init_options_init().
$ ros2 topic info -v /str1 --no-daemon
[INFO] [1589753151.364450457] []: >>> rcl_init_options_init
[INFO] [1589753151.364512790] []: >>> rmw_init_options_init
[INFO] [1589753151.364525402] []: >>> rcl_init_options_init
[INFO] [1589753151.364531202] []: >>> rmw_init_options_init
[INFO] [1589753151.364552913] []: >>> rclpy_init pre rmw_init
[INFO] [1589753151.364607009] []: >>> rmw_init
How is rmw_init_options_init() loaded from the rmw implementation shared library before the shared library is loaded in rmw_init()???
I added a trace to rmw_implementation/ function.cpp, and was pleasantly surprised to see that something is loading the function just before it is called: pastebin output
So, what's causing get_symbol() to be called?
The CALL_SYMBOL macro seems to indicate that it's responsible, but I'm not yet sure how...