-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup visibility to enable compilation on Windows #1053
Comments
Thanks for this detailed explanation: Finally I understand why this is necessary at all (ping ros-controls/ros2_control_demos#73 😉) fyi: I added this to the agenda of the working group meeting next week, let's discuss it there if no one comments here until then. |
Ok, I will try to attend so we can discuss/explain if anyone has specific questions, thanks! |
I would go with S3 and fix all the issues we currently have. |
I kind of have already patches for this, see:
The tricky aspect is that the classes have a lot of protected methods, that technically are part of the public interface. I added patches for all the protected methods (as for example |
The discussion on this topic at the WG meeting yesterday concluded with Option S1. Does the S stand for Silvio? ;) @traversaro |
I had to think a bit about it. :D I think it wanted to stand for "Solution". |
As S1 was decided, I realized that there are a few decision to make:
|
sidenote: I'd remove them from the demos soon, because we don't release the demos repos and can easily get rid of the boilerplate code there for every distro. |
@traversaro did you have time to work on this? as we are preparing more breaking stuff on rolling, now it's the time to break even more ;) |
Cool! With summer coming I hope to be able to prepare some PRs on this, thanks for the ping! |
I would like to compile and run the software of this repo on Windows. I was able to do so with #1039 and ros-controls/ros2_control@master...traversaro:ros2_control:patch-2 . However, given the comments in #1039 (comment), I thought it made sense to open an issue to discuss what is the preferred way to handle visibility of symbols on Windows.
Describe the solution you'd like
Differently from Linux and macOS, on Windows by default the symbols of shared libraries are not exported. To deal with this, there are several strategies:
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
. The upside is the only change necessary to support a shared library CMake project on Windows is to add aset(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
cmake line, no other change is necessary beside some specific corner cases. The downside of this is all symbols (even the private one) are exported, but this also applies also on Linux and macOS.generate_export_header
CMake macro.generate_export_header
.Unless the shared library is particularly big, I typically prefer to adopt S1, as it is the strategy that put the least possible burden of library maintainers and authors, especially if most of them is not familiar with Windows. If S2 or S3 are used, I personally prefer at least to make sure that the visibility is hidden by default also on Linux and macOS, to permit developers to make sure that the visibility macros are working appropriately even without using Windows.
For some reasons (some discussed in ament/ament_cmake#201 (comment) and ament/ament_cmake#164) core ros2 packages use the S3 strategy, even if only a subset of packages actually set the visibility to hidden in non-Windows platforms (see https://github.com/search?q=org%3Aros2+hidden+language%3ACMake&type=code). Apparently the S3 strategy is used also on ros2_control repos.
Given this discussion, I would like to know what maintainers prefer:
The text was updated successfully, but these errors were encountered: