Skip to content

Commit 8f361a1

Browse files
correct name of shared libraries and their location (#722) (#726)
* correct name of shared libraries and their location * add instruction for running dlopen_composition in separate sections of Linux and windows * format the composition Documentation --------- (cherry picked from commit c3a5fdf) Signed-off-by: Aniket Kumar Roy <aniketroy769@gmail.com> Co-authored-by: Aniket Kumar Roy <aniketroy769@gmail.com>
1 parent 2d283be commit 8f361a1

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

composition/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,53 @@ ros2 run composition manual_composition
3535

3636
This runs `dlopen_composition` which is an alternative to run-time composition by creating a generic container process and explicitly passing the libraries to load without using ROS interfaces.
3737

38+
First run the command to find the libraries prefix path.
39+
40+
```bash
41+
ros2 pkg prefix composition
42+
```
43+
44+
Then you can find the prefix path of the required shared libraries to load.
45+
3846
The process will open each library and create one instance of each “rclcpp::Node” class in the library.
3947

48+
```bash
49+
ros2 run composition dlopen_composition <path_to_talker_component_shared_library> <path_to_listener_component_shared_library>
50+
```
51+
52+
#### Linux
53+
54+
The libraries will be present in `<prefix_path>/lib/` as `lib*.so` files.
55+
56+
Run the following command to load the libraries.
57+
4058
```bash
4159
ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so
4260
```
4361

62+
#### Windows
63+
64+
On Windows, we will need the `*.dll` files.
65+
Since command substitution will not work on Windows, you have to give the absolute path of the libraries.
66+
67+
The libraries will be in `<path_to_your_ros2_installation>\bin\`, so we have to run.
68+
69+
```bash
70+
ros2 run composition dlopen_composition <prefix_path>\bin\talker_component.dll <prefix_path>\bin\listener_component.dll
71+
```
72+
73+
To get the `prefix_path` run
74+
75+
```bash
76+
ros2 pkg prefix composition
77+
```
78+
79+
For example if our `prefix_path` comes out to be `C:\pixi_ws\ros2-windows\` we will run
80+
81+
```bash
82+
ros2 run composition dlopen_composition C:\pixi_ws\ros2-windows\bin\talker_component.dll C:\pixi_ws\ros2-windows\bin\listener_component.dll
83+
```
84+
4485
### Linktime Composition
4586

4687
Similar to previous, this runs `linktime_composition` which **links all classes from libraries** that are registered under the **library_path** with the **linker**.

0 commit comments

Comments
 (0)