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

Added possibility to compile this library as a static or dynamic library #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atvise
Copy link
Contributor

@atvise atvise commented Apr 14, 2017

  • visibility.h/Makefile - Added possibility to compile this library as a static or dynamic library
  • value.h - Fixed friend declarations because the must have also the PHPCPP_EXPORT declaration (C2375 redefinition; different linkage)
  • streams.h - Fixed extern thread_local stream definition because the can't have PHPCPP_EXPORT declaration (C2492 'deprecated': data with thread storage duration may not have dll interface)

- visibility.h/Makefile - Added possibility to compile this library as a static or dynamic library
- value.h - Fixed friend declarations because the must have also the PHPCPP_EXPORT declaration (C2375 redefinition; different linkage)
- streams.h - Fixed extern thread_local stream definition because the can't have PHPCPP_EXPORT declaration (C2492 'deprecated': data with thread storage duration may not have dll interface)
friend Value constant(const char *name, size_t size);
friend bool define(const char *name, size_t size, const Value &value);
friend PHPCPP_EXPORT Value constant(const char *name, size_t size);
friend PHPCPP_EXPORT bool define(const char *name, size_t size, const Value &value);
Copy link

@weltling weltling Jul 1, 2017

Choose a reason for hiding this comment

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

This and other items from the file should be a separate PR. The issue will show up with any build with the strict visibility flags, fe on Fedora.

Thanks.

extern thread_local std::ostream error;
extern thread_local std::ostream notice;
extern thread_local std::ostream warning;
extern thread_local std::ostream deprecated;
Copy link

Choose a reason for hiding this comment

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

IMO, this change is wrong. It needs a profound solution for non GNU compatible compiler. Basically, it still needs a DSO export, but should encapsulate thread safe pieces. I'd allow myself also to reference #90 (comment) . Anyway, it doesn't belong to the PR about static enablement, as it would be controlled by the header where PHPCPP_EXPORT would evaluate to empty already. Right now, the DLL build is simply broken, anyway.

Thanks.

#endif
#define DLL_EXPORT
Copy link

Choose a reason for hiding this comment

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

Why does it need two different specifiers? Either PHPCPP_EXPORT targets DLL or static build.

Thanks.

#else /* build static library */
#define PHPCPP_EXPORT
#endif
#define DLL_EXPORT
Copy link

Choose a reason for hiding this comment

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

This piece seems wrong. If the attribute is supported, DLL_EXPORT should be same as PHPCPP_EXPORT.

In general I see what you're striving to achieve, but it is not going to work well. An extension should define its own API inside it, using same specifier will still require additional compiler flags. Fe if there's a static phpcpp lib, get_module() inside the extension will still have to be DLL exported.

Thanks.

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