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

mac/option: fix type of global init variable #15395

Closed
wants to merge 1 commit into from

Conversation

Akemi
Copy link
Member

@Akemi Akemi commented Nov 27, 2024

clipboard/clipboard.h includes common/global.h where the mpv_global struct is defined. clipboard/clipboard.h furthermore is now included on player/core.h, which is included in the swift bridging header. because of this swift now knows the mpv_global struct and isn't treating it as an OpaquePointer anymore. this leads to a build error because swift is strongly typed.

properly type the global variable in the OptionHelper. also pre-emptively include the common/global.h file in the swift bridging header to prevent swift from 'forgetting' the mpv_global struct again, in the case the includes change.

Fixes e1d30c4

clipboard/clipboard.h includes common/global.h where the mpv_global
struct is defined. clipboard/clipboard.h furthermore is now included on
player/core.h, which is included in the swift bridging header. because
of this swift now knows the mpv_global struct and isn't treating it as
an OpaquePointer anymore. this leads to a build error because swift is
strongly typed.

properly type the global variable in the OptionHelper. also
pre-emptively include the common/global.h file in the swift bridging
header to prevent swift from 'forgetting' the mpv_global struct again,
in the case the includes change.

Fixes e1d30c4
@na-na-hi
Copy link
Contributor

Can you remove the common/global.h include in clipboard/clipboard.h and move it to clipboard/clipboard.c instead? Only the latter needs to access the global struct, the header doesn't need that.

Copy link

Download the artifacts for this pull request:

Windows
macOS

@kasper93
Copy link
Contributor

Can you remove the common/global.h include in clipboard/clipboard.h and move it to clipboard/clipboard.c instead? Only the latter needs to access the global struct, the header doesn't need that.

I did it already in #15396

@Akemi
Copy link
Member Author

Akemi commented Nov 27, 2024

closing in favour of #15396.

@Akemi Akemi closed this Nov 27, 2024
@Akemi
Copy link
Member Author

Akemi commented Nov 30, 2024

looked into all the OpaquePointer and additional to mpv_global we only use these structs that are all private: struct mpv_handle, struct input_ctx, struct mpv_render_context, struct mp_log.

so there actually is nothing else to do besides what was already done here. reopening this one and adjusted the commit message.

[edit]
okay have to reopen the PR

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