Skip to content

objc: add protocol support #46

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

Merged
merged 5 commits into from
Sep 15, 2022
Merged

objc: add protocol support #46

merged 5 commits into from
Sep 15, 2022

Conversation

TotallyGamerJet
Copy link
Collaborator

This is needed for ebitengien#2326.

Should the GetProtocol function return a pointer to Protocol or just Protocol? The Objective-C runtime returns a pointer however there is never a reason for us to need to dereference this pointer so I thought it best to just remove it.

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM!

@TotallyGamerJet
Copy link
Collaborator Author

Did you want to discuss my question first or do you agree with my conclusion?

@hajimehoshi
Copy link
Member

Sorry I missed that.

Should the GetProtocol function return a pointer to Protocol or just Protocol? The Objective-C runtime returns a pointer however there is never a reason for us to need to dereference this pointer so I thought it best to just remove it.

Hm, then

	p, _, _ := purego.SyscallN(objc_getProtocol, uintptr(unsafe.Pointer(n)))
	return Protocol(p)

Doesn't this SyscallN return a pointer to Protocol instead of a Protocol itself?

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

Let's resolve the signature issue

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM!

@TotallyGamerJet TotallyGamerJet merged commit aa1b0f6 into ebitengine:main Sep 15, 2022
@TotallyGamerJet TotallyGamerJet deleted the protocols branch September 15, 2022 04:41
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