Skip to content
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

Implement proper C++ visibility support? #15

Open
claudiofantacci opened this issue May 1, 2019 · 6 comments
Open

Implement proper C++ visibility support? #15

claudiofantacci opened this issue May 1, 2019 · 6 comments

Comments

@claudiofantacci
Copy link
Collaborator

Implement C++ visibility support as described here.

This will probably allow us to remove this Windows-specific CMake instruction.

An example of this implementation can be found in YARP in conf/api.h used, e.g., in os/api.h.

@traversaro
Copy link
Member

traversaro commented May 3, 2019

The CMake's macro GenerateExportHeader may also be useful.

A thing that is typically tricky to get right is to correctly disable the visibility flags on Windows when building a static library. Related discussion: ros/console_bridge#40 (comment) .

@claudiofantacci
Copy link
Collaborator Author

@traversaro great, thanks for your feedback. I'll have a look at it and see what I can do 👍
I'll write here any thought I will have during the process.

@claudiofantacci
Copy link
Collaborator Author

@traversaro, the GenerateExportHeader macro seems super cool and capable of handling the static library issue with little more effort.
I will try using it and, if succesful, include it in our how-to-export-cpp-library with the proper documentation 👍

@traversaro
Copy link
Member

Yes. To be honest I think that for most cases in research code the benefit of a clean list of symbols is not worth the overhead of making sure that the visibility macros are properly used, but this is probably a decision that it make sense to do on a per-project basis.

@claudiofantacci
Copy link
Collaborator Author

Yes. To be honest I think that for most cases in research code the benefit of a clean list of symbols is not worth the overhead of making sure that the visibility macros are properly used, but this is probably a decision that it make sense to do on a per-project basis.

100% agree 🚀

@traversaro
Copy link
Member

traversaro commented May 9, 2019

The issue robotology/icub-main#577 is a good example of issue that would be avoided if CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS was used instead of manually adding visibility decorators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants