Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions composition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<path_to_your_ros2_installation>\bin\`, so we have to run.

```bash
ros2 run composition dlopen_composition <prefix_path>\bin\talker_component.dll <prefix_path>\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**.

Expand Down
7 changes: 7 additions & 0 deletions composition/src/linktime_composition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ int main(int argc, char * argv[])
std::vector<std::unique_ptr<class_loader::ClassLoader>> loaders;
std::vector<rclcpp_components::NodeInstanceWrapper> 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<std::string> libraries = {
// all classes from libraries linked by the linker (rather than dlopen)
// are registered under the library_path ""
Expand Down