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

Manually disable symbol export #4266

Merged
merged 1 commit into from Oct 7, 2021
Merged

Conversation

egpbos
Copy link
Contributor

@egpbos egpbos commented Oct 6, 2021

Problem: when linking to libzmq in my project, I want zmq symbols to remain invisible to users of my library. There is no way to control this, since visibility is set automatically through ZMQ_EXPORT based on OS and compiler.

Solution: add a preprocessor variable ZMQ_NO_EXPORT that, when set, bypasses the automatic ZMQ_EXPORT determination block and just sets ZMQ_EXPORT to empty.

By combining this solution at configuration time with manually passing -fvisibility=hidden to CXXFLAGS, I solved my visibility problem. Just passing -fvisibility=hidden is not enough, because __attribute__ ((visibility ("default"))) has higher priority.

configure.ac Outdated Show resolved Hide resolved
@egpbos egpbos requested a review from bluca October 6, 2021 18:36
@bluca bluca enabled auto-merge (squash) October 6, 2021 20:34
@egpbos
Copy link
Contributor Author

egpbos commented Oct 7, 2021

Not sure what's going on with that pending build, is that OBS?

auto-merge was automatically disabled October 7, 2021 07:37

Head branch was pushed to by a user without write access

@egpbos
Copy link
Contributor Author

egpbos commented Oct 7, 2021

Ah, force pushing a non-changed amended commit apparently doesn't retrigger CI, still stalling :) Could you restart it?

…remain invisible to users of my library. There is no way to control this, since visibility is set automatically through ZMQ_EXPORT based on OS and compiler.

Solution: add a preprocessor variable ZMQ_NO_EXPORT that, when set, bypasses the automatic ZMQ_EXPORT determination block and just sets ZMQ_EXPORT to empty.

By combining this solution at configuration time with manually passing -fvisibility=hidden to CXXFLAGS, I solved my visibility problem. Just passing -fvisibility=hidden is not enough, because __attribute__ ((visibility ("default"))) has higher priority.
@egpbos
Copy link
Contributor Author

egpbos commented Oct 7, 2021

I rebased into one commit, but still doesn't seem to trigger the OBS builds.

@bluca bluca merged commit 9fbfa40 into zeromq:master Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants