From 3ec595ed49ff60f3ab75aada97873a583c1bd62a Mon Sep 17 00:00:00 2001 From: yadunund Date: Fri, 3 Oct 2025 00:47:05 -0700 Subject: [PATCH] Log message for linktime composition on Windows (#640) Signed-off-by: Yadunund Co-authored-by: Alejandro Hernandez Cordero (cherry picked from commit 8c49a99ccbc130ddc82d726ce038943b78038f75) --- composition/README.md | 25 +----------------------- composition/src/linktime_composition.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/composition/README.md b/composition/README.md index 94abf150b..21e5b27d0 100644 --- a/composition/README.md +++ b/composition/README.md @@ -59,30 +59,7 @@ Run the following command to load the libraries. ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so ``` -#### Windows - -On Windows, we will need the `*.dll` files. -Since command substitution will not work on Windows, you have to give the absolute path of the libraries. - -The libraries will be in `\bin\`, so we have to run. - -```bash -ros2 run composition dlopen_composition \bin\talker_component.dll \bin\listener_component.dll -``` - -To get the `prefix_path` run - -```bash -ros2 pkg prefix composition -``` - -For example if our `prefix_path` comes out to be `C:\pixi_ws\ros2-windows\` we will run - -```bash -ros2 run composition dlopen_composition C:\pixi_ws\ros2-windows\bin\talker_component.dll C:\pixi_ws\ros2-windows\bin\listener_component.dll -``` - -### Linktime Composition +### Linktime Composition (not supported on Windows) Similar to previous, this runs `linktime_composition` which **links all classes from libraries** that are registered under the **library_path** with the **linker**. diff --git a/composition/src/linktime_composition.cpp b/composition/src/linktime_composition.cpp index 0ae19b277..e9c0d6218 100644 --- a/composition/src/linktime_composition.cpp +++ b/composition/src/linktime_composition.cpp @@ -36,6 +36,13 @@ int main(int argc, char * argv[]) std::vector> loaders; std::vector node_wrappers; + // Linktime composition is not supported on Windows. + #ifdef _WIN32 + RCLCPP_ERROR(logger, "Linktime composition is not supported on Windows."); + rclcpp::shutdown(); + return 0; + #endif // _WIN32 + std::vector libraries = { // all classes from libraries linked by the linker (rather than dlopen) // are registered under the library_path ""