-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
The dll.h is made static again (revert commit 0733aeb4) #1064
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,61 @@ | ||
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 | ||
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 | ||
|
||
// Definition YAML_CPP_STATIC_DEFINE using to building YAML-CPP as static | ||
// library (definition created by CMake or defined manually) | ||
|
||
// Definition yaml_cpp_EXPORTS using to building YAML-CPP as dll/so library | ||
// (definition created by CMake or defined manually) | ||
|
||
#ifdef YAML_CPP_STATIC_DEFINE | ||
# define YAML_CPP_API | ||
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. Do you need to define these symbols at all in the static case? 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. Yes, for a static assembly, the YAML_CPP_STATIC_DEFINE must be defined in the yaml-cpp library, as well as in the target application. 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. What I mean is, in the static case, do you need to define YAML_CPP_API at all? 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. M-m-m...perhaps I don't quite understand the question (translation difficulties). But still I'll try to answer: theoretically, for the variant of static build the definition YAML_CPP_API is not needed, but from a practical point of view, YAML_CPP_API must be present - otherwise the project will not build |
||
# define YAML_CPP_NO_EXPORT | ||
#else | ||
# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) | ||
# ifndef YAML_CPP_API | ||
# ifdef yaml_cpp_EXPORTS | ||
/* We are building this library */ | ||
# pragma message( "Defining YAML_CPP_API for DLL export" ) | ||
# define YAML_CPP_API __declspec(dllexport) | ||
# else | ||
/* We are using this library */ | ||
# pragma message( "Defining YAML_CPP_API for DLL import" ) | ||
# define YAML_CPP_API __declspec(dllimport) | ||
# endif | ||
# endif | ||
# ifndef YAML_CPP_NO_EXPORT | ||
# define YAML_CPP_NO_EXPORT | ||
# endif | ||
# else /* No _MSC_VER */ | ||
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. What cases (compilers/operating systems) does this else case catch? What's the reason for the differing definition? 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. As far as I know, in Windows all functions are hidden by default for export. You must explicitly use the 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. @jbeder it's much the same as the suggested form from gcc https://gcc.gnu.org/wiki/Visibility 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. Thanks, sounds good to me. |
||
# ifndef YAML_CPP_API | ||
# ifdef yaml_cpp_EXPORTS | ||
/* We are building this library */ | ||
# define YAML_CPP_API __attribute__((visibility("default"))) | ||
# else | ||
/* We are using this library */ | ||
# define YAML_CPP_API __attribute__((visibility("default"))) | ||
# endif | ||
# endif | ||
# ifndef YAML_CPP_NO_EXPORT | ||
# define YAML_CPP_NO_EXPORT __attribute__((visibility("hidden"))) | ||
# endif | ||
# endif /* _MSC_VER */ | ||
#endif /* YAML_CPP_STATIC_DEFINE */ | ||
|
||
#ifndef YAML_CPP_DEPRECATED | ||
# ifdef _MSC_VER | ||
# define YAML_CPP_DEPRECATED __declspec(deprecated) | ||
# else | ||
# define YAML_CPP_DEPRECATED __attribute__ ((__deprecated__)) | ||
# endif | ||
#endif | ||
|
||
#ifndef YAML_CPP_DEPRECATED_EXPORT | ||
# define YAML_CPP_DEPRECATED_EXPORT YAML_CPP_API YAML_CPP_DEPRECATED | ||
#endif | ||
|
||
#ifndef YAML_CPP_DEPRECATED_NO_EXPORT | ||
# define YAML_CPP_DEPRECATED_NO_EXPORT YAML_CPP_NO_EXPORT YAML_CPP_DEPRECATED | ||
#endif | ||
|
||
#endif /* DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 */ |
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.
It seems more natural to me to add a definition for the shared lib, which is the unusual case. (I don't feel super strongly, but since it looks like it doesn't matter one way or another, I thought I'd say something.)
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.
I am not a specialist at CMake, so this change is made by virtue of my little knowledge in this assembly system. I guess you can change this section as you see fit.
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.
OK, I guess it really doesn't matter much. I'll merge the code now and any improvements can be made after the fact.