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

Fix inconsistent linkage when building as static on Windows #296

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

Conversation

haileys
Copy link

@haileys haileys commented Jan 20, 2024

EPOXY_PUBLIC is defined to __declspec(dllexport) extern in meson.build only if building as a shared library on Windows. Otherwise it's defined to extern if building as a shared library, and if building as static, it is not defined at all.

However, when EPOXY_PUBLIC is not defined, epoxy/common.h will define EPOXY_PUBLIC to __declspec(dllimport) extern if building on MSVC.

I'm not exactly sure what's going on with the duplicated definition here, but I have worked around the problem by defining EPOXY_SHARED if building as a shared library. This define is set in common_cflags, which means it will be propagated through to pkgconfig, so consuming libraries will set this variable appropriately. Then I have changed common.h to only define EPOXY_PUBLIC for dll imports if EPOXY_SHARED is also set.

@ebassi
Copy link
Collaborator

ebassi commented Jan 24, 2024

Thanks! I'll review this MR soon once I can properly test it.

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