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

Add visibility attribute to import declaration #66

Merged
merged 2 commits into from
Jan 22, 2021

Conversation

ricrogz
Copy link
Collaborator

@ricrogz ricrogz commented Jan 19, 2021

Apparently, clang doesn't correctly handle type comparisons with mismatched visibility: even if a library is compiled with default visibility, if the code linking it compiles using "hidden" visibility, types won't be correctly matched, creating problems at least in catching exceptions.

This is better explained in the last few comments in rdkit/rdkit/issues/2753. There are also some links to a proof of concept I built to demonstrate the problem with the RDKit.

Copy link
Collaborator

@d-b-w d-b-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for sussing this out.

@@ -15,7 +15,7 @@
#ifdef WIN32
#define EXPORT_MAEPARSER __declspec(dllimport)
#else
#define EXPORT_MAEPARSER
#define EXPORT_MAEPARSER __attribute__((visibility("default")))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind reordering so that it's

#ifdef WIN32
#ifdef IN_MAEPARSER
#define EXPORT_MAEPARSER __declspec(dllexport)
#else
#define EXPORT_MAEPARSER __declspec(dllimport)
#endif

#else
#define EXPORT_MAEPARSER __attribute__((visibility("default")))
#endif

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@d-b-w d-b-w merged commit 386e1c1 into schrodinger:master Jan 22, 2021
@ricrogz ricrogz deleted the add_import_visbility branch January 22, 2021 13:45
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.

2 participants