How to link RMW implementation when compiling (Universal Windows Platform)
I'm trying to build ROS2 for use in Univeral Windows Platform applications, which is more restrictive about loading libraries at runtime. Due to this limitation, I'm interested in knowing if it's possible to link against a particular rmw implementation (e.g., rmw_fastrtps_cpp
) at build time, and avoid any use of LoadLibrary in the ROS code.
I see there is a CMake option in rmw_implementation
for disabling runtime selection of the particular implementation but I wasn't able to clearly determine if that was doing a compile-time link or only allowing the default implementation to be loaded dynamically. Can anyone clarify how the option works?
If the implementation is still being loaded at run-time, is there a way to link at build instead? What would be the path to making that possible?
Asked by jdlangs on 2021-03-09 16:22:02 UTC
Comments
I remember @OoeyGUI mentioning they were working on ROS 2 in UWP environments.
Perhaps he has a tip?
Asked by gvdhoorn on 2021-03-10 04:12:15 UTC
Thanks for the loop in. We are working on having ROS2 built for Hololens, and have a demonstration for Eloquent. (I'm working on Foxy). The repo with the nuget package and unity package manager is at https://github.com/ms-iot/ros_msft_mrtk_native.
I have a fix for loading on UWP in the loader - but need to migrate it to fox: https://github.com/ooeygui/rcpputils/commit/845546461f777d803be7746c623423ec64c264b7
Hope that helps! Lou
Asked by OoeyGUI on 2021-03-10 15:16:15 UTC
Thanks, both, for your comments. I probably could have phrased it better since I don't actually need help finding a solution to dynamic library loading; we've already been consulting with Lou and using his patches. I was more curious in general if it's currently possible to not have to load the middleware dynamically and if not, how hard would it be to make that possible.
Asked by jdlangs on 2021-03-10 15:43:03 UTC
I remembered Dirk working on this at some point in the past.
Related issues:
that last one summarises the current state as far as I know: maybe it can work, but it depends on what is used exactly. Later comments seem to indicate static linking doesn't work any more.
Edit: and see #q347006 for another question about statically linking ROS 2 applications.
Asked by gvdhoorn on 2021-03-11 02:44:57 UTC
Did some more edits to try and be clearer. I'm not actually asking about static linking; dynamic linking is fine, I'm interested in avoiding dynamic loading.
Asked by jdlangs on 2021-03-11 10:30:04 UTC
I believe from a OS perspective there isn't much difference (between the linker linking at runtime vs
LoadLibrary(..)
), but perhaps @OoeyGUI can weigh in again.Asked by gvdhoorn on 2021-03-11 12:17:14 UTC