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

libBlocksRuntime: Mark public symbols with dllexport #19777

Merged
merged 2 commits into from
Jan 20, 2024

Conversation

qmfrederik
Copy link
Contributor

@qmfrederik qmfrederik commented Jan 16, 2024

Functions which are marked with BLOCK_EXPORT are supposed to be externally visible, but miss the __attribute__((dllexport)) attribute. As a result, they are not exported from a .dll when compiled with clang.

Additionally, methods marked with __attribute__((dllexport)) cannot have the __attribute__((weak)) attribute applied to them, so make that conditional on being compiled for non-Windows platforms.

Together with #19767, this helps compiling Objective C code on MinGW using the clang compiler.

@Biswa96
Copy link
Member

Biswa96 commented Jan 16, 2024

Thank you for the contribution. Just curious, should there be any condition for static vs. shared libraries?

@qmfrederik
Copy link
Contributor Author

That's a good question. It doesn't look like the blocksruntime build setup is set up to really differentiate for this at build time -- it uses the same object files for creating the static and shared library:

libtool: link: clang -shared  .libs/libBlocksRuntime_la-runtime.o .libs/libBlocksRuntime_la-data.o    -g -O2 -fuse-ld=lld   -o .libs/libBlocksRuntime-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libBlocksRuntime.dll.a
libtool: link: ar cr .libs/libBlocksRuntime.a  libBlocksRuntime_la-runtime.o libBlocksRuntime_la-data.o

Additionally, I don't really see a use case where you would want to use this as a static library. It's part of the (modern) Objective C runtime. Your application probably uses multiple shared libraries, all of which would reference the blocks runtime as a shared library.

It doesn't look like this package has been maintained very will since it was added 7 years ago (#3123). It also seems no other package depends on this.

A option could be to just stop publishing static versions of libblocksruntime?

@Adsun701 any thoughts?

@Adsun701
Copy link
Contributor

@qmfrederik I think it would be a good idea to stop using static versions of libblocksruntime.

@qmfrederik qmfrederik force-pushed the blocksruntime-symbols branch from 1e71e59 to 04fb624 Compare January 18, 2024 21:40
@qmfrederik
Copy link
Contributor Author

@Biswa96 @Adsun701 I've removed the static build of libblocksruntime. Let me know if there's anything else you need!

@Adsun701
Copy link
Contributor

@qmfrederik @Biswa96 I think that's good!

@lazka lazka merged commit 36dfbe1 into msys2:master Jan 20, 2024
8 checks passed
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.

4 participants