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

Add types to mapType #149

Closed

Conversation

programmingkidx
Copy link
Contributor

A lot of methods are skipped by the wrapper generation system because the type they return on not in the mapType() function. To increase the number of Objective-C methods that are wrapped this patch adds support for these types:

  • char
  • short
  • float
  • double
  • long
  • long long
  • uint32_t
  • size_t

@programmingkidx
Copy link
Contributor Author

I wasn't sure if I should include changes to generated files so I will include them here.

0001-more-types.patch

@tmc
Copy link
Collaborator

tmc commented Jul 20, 2023

@programmingkidx instead of attaching a patch could you push a commit?

edit: doing so for you

@programmingkidx
Copy link
Contributor Author

Is there anything else stopping this pull request from being merged?

@progrium
Copy link
Owner

@tmc look good?

Copy link
Collaborator

@tmc tmc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@tmc tmc left a comment

Choose a reason for hiding this comment

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

erh there seems to be a problem:

Error: core/core_objc.gen.go:4886:2: x redeclared in this block
Error: core/core_objc.gen.go:4883:7: other declaration of x

@programmingkidx
Copy link
Contributor Author

This is the error I see when I try to build a program with this commit in place:

macdriver/core/core_objc.gen.go:4960:2: x redeclared in this block
macdriver/core/core_objc.gen.go:4957:7: other declaration of x
macdriver/core/core_objc.gen.go:4966:10: cannot convert x (variable of type gen_NSObject) to type C.uint

I traced the issue to a method called ProvideImageDataBytesPerRowOrigin(). According to the documentation there is no method with this name. There is one called provideImageData:bytesPerRow:origin::size::userInfo:. I'm guessing this is a bug.

My first idea to fix this issue was to open the json file for NSObject and change the argument's name from x to x1. Problem is there is no json file.

I then did a grep search. It showed ProvideImageDataBytesPerRowOrigin to only be in the core/core_objc.gen.go file, so this means I am not sure where this method comes from.

@tmc Any idea where the ProvideImageDataBytesPerRowOrigin() method comes from?

@programmingkidx
Copy link
Contributor Author

I found where ProvideImageDataBytesPerRowOrigin() comes from. It is from api/objectivec/nsobject.objc.json. I fixed the problem by changing the name of the receiver variable.

@programmingkidx
Copy link
Contributor Author

The current problem with this pull request is with a method called preservationPriorityForTag:. This is the error I see:

macdriver/cocoa/cocoa_objc.gen.go:742:3: error: 'preservationPriorityForTag:' is unavailable: not available on macOS
preservationPriorityForTag: tag];

This is an issue with the API_UNAVAILABLE() macro. MacDriver does not currently have a system in place to handle this situation.

@progrium
Copy link
Owner

progrium commented Aug 8, 2023

Not sure how this issue fell out of the documented change proposed. Maybe that it opened up new methods to be supported that introduced these errors? Anyway, I made sure these types are supported in darwinkit, so I'm closing this PR. Thanks!

@progrium progrium closed this Aug 8, 2023
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