-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fixes for usage on windows #91
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef SRDFDOM__VISIBILITY_CONTROL_H_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use GenerateExportHeader .? Do you know what are the drawbacks .? I'm happy to open a PR against your branch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There has been some discussion here: moveit/moveit2#286 (review), and I think using the visibility headers instead of the cmake function would be better. To quote from links from that discussion:
|
||
#define SRDFDOM__VISIBILITY_CONTROL_H_ | ||
|
||
// This logic was borrowed (then namespaced) from the examples on the gcc wiki: | ||
// https://gcc.gnu.org/wiki/Visibility | ||
|
||
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define SRDFDOM_EXPORT __attribute__((dllexport)) | ||
#define SRDFDOM_IMPORT __attribute__((dllimport)) | ||
#else | ||
#define SRDFDOM_EXPORT __declspec(dllexport) | ||
#define SRDFDOM_IMPORT __declspec(dllimport) | ||
#endif | ||
#ifdef SRDFDOM_BUILDING_DLL | ||
#define SRDFDOM_PUBLIC SRDFDOM_EXPORT | ||
#else | ||
#define SRDFDOM_PUBLIC SRDFDOM_IMPORT | ||
#endif | ||
#define SRDFDOM_PUBLIC_TYPE SRDFDOM_PUBLIC | ||
#define SRDFDOM_LOCAL | ||
#else | ||
#define SRDFDOM_EXPORT __attribute__((visibility("default"))) | ||
#define SRDFDOM_IMPORT | ||
#if __GNUC__ >= 4 | ||
#define SRDFDOM_PUBLIC __attribute__((visibility("default"))) | ||
#define SRDFDOM_LOCAL __attribute__((visibility("hidden"))) | ||
#else | ||
#define SRDFDOM_PUBLIC | ||
#define SRDFDOM_LOCAL | ||
#endif | ||
#define SRDFDOM_PUBLIC_TYPE | ||
#endif | ||
|
||
#endif // SRDFDOM__VISIBILITY_CONTROL_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this .? adding
SRDFDOM_EXPORT
toSRDFWriter
should make this obsolete, right .?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that should make it obsolete. We would need to add
SRDFDOM_PUBLIC
because the export should only occur while building and it should import when another library includes it.However, you would need to manually add
SRDFDOM_PUBLIC
to all new classes, and that might be easy to forget. I still think the global export should be used since it's much simpler than tagging all new classes and more closely matches the behavior of other compilers.