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

The dll.h is made static again (revert commit 0733aeb4) #1064

Merged
merged 3 commits into from
Nov 23, 2021

Conversation

hkarel
Copy link
Contributor

@hkarel hkarel commented Nov 20, 2021

New dll.h is assembly from cmake-generation for GCC, MSVC, MIGW

Copy link
Owner

@jbeder jbeder left a comment

Choose a reason for hiding this comment

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

Thanks, this is awesome. Could you rebase this against master and reopen the pull request? That will trigger the actions (I'm not sure how to trigger them otherwise) so it'll run the automatic tests.

# ifndef YAML_CPP_NO_EXPORT
# define YAML_CPP_NO_EXPORT
# endif
# else /* No _MSC_VER */
Copy link
Owner

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 __declspec(dllexport) directive to export functions from the library. On the contrary, in Linux all functions by default are exports. Sometimes in Linux (often for reasons of project build speed) there is a need to hide some of the functions. To do this, using the directive __attribute__((("hidden")). If in the future will be need to hide some of the functions for assembly on Linux/Unix platforms, this macro will be useful. Now it's just a formal record.

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks, sounds good to me.

else()
set(yaml-cpp-type STATIC)
set(yaml-cpp-label-postfix "static")
add_definitions(-DYAML_CPP_STATIC_DEFINE)
Copy link
Owner

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.)

Copy link
Contributor Author

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.

Copy link
Owner

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.

// (definition created by CMake or defined manually)

#ifdef YAML_CPP_STATIC_DEFINE
# define YAML_CPP_API
Copy link
Owner

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
For the static case, the macros YAML_CPP_API and YAML_CPP_NO_EXPORT must be dummy.

Copy link
Owner

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

@hkarel hkarel changed the base branch from revert-1045-hidden-visibility-again to master November 22, 2021 07:46
@hkarel
Copy link
Contributor Author

hkarel commented Nov 22, 2021

Could you rebase this against master and reopen the pull request? That will trigger the actions (I'm not sure how to trigger them otherwise) so it'll run the automatic tests.

I relocated PR to master

@hkarel hkarel requested a review from jbeder November 22, 2021 08:01
@PhilipDeegan
Copy link
Contributor

PhilipDeegan commented Nov 22, 2021

Could you rebase this against master and reopen the pull request? That will trigger the actions (I'm not sure how to trigger them otherwise) so it'll run the automatic tests.

I relocated PR to master

it's possible you might have to make a new PR if you were missing the github actions file(s) originally, although @jbeder can probably run it manually

@hkarel
Copy link
Contributor Author

hkarel commented Nov 22, 2021

Could you rebase this against master and reopen the pull request? That will trigger the actions (I'm not sure how to trigger them otherwise) so it'll run the automatic tests.

I relocated PR to master

it's possible you might have to make a new PR if you were missing the github actions file(s) originally, although @jbeder can probably run it manually

I tried creating a new PR (copy of this PR). It didn't work, I was redirected to this page. Apparently github keeps track of PR copies.

@PhilipDeegan
Copy link
Contributor

it normally lets you create a new one but shows you the existing one in case you just want that one
but it looks like you have it done here https://github.com/hkarel/yaml-cpp/actions/runs/1484364184

else()
set(yaml-cpp-type STATIC)
set(yaml-cpp-label-postfix "static")
add_definitions(-DYAML_CPP_STATIC_DEFINE)
Copy link
Owner

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.

@jbeder jbeder merged commit 2b65c65 into jbeder:master Nov 23, 2021
@hkarel hkarel deleted the revert-1045-hidden-visibility-again branch November 23, 2021 19:43
@hkarel hkarel restored the revert-1045-hidden-visibility-again branch November 23, 2021 19:45
@hkarel hkarel deleted the revert-1045-hidden-visibility-again branch November 23, 2021 19:48
davemccann pushed a commit to davemccann/yaml-cpp that referenced this pull request Jul 30, 2023
…beder#1064)

Partial revert of "Revert "Revert "Hide most of non-public symbols by default (jbeder#984)" (jbeder#1038)" (jbeder#1045)"

This reverts commit 0733aeb.
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.

3 participants