Add objc_sys crate#19
Merged
Merged
Conversation
109a816 to
6382f37
Compare
Types: - Imp -> IMP - Object -> objc_object - Sel -> objc_selector - Protocol -> objc_protocol - Class -> objc_class - Ivar -> objc_ivar - Method -> objc_method New type aliases: - id - SEL - Class - Ivar - Method - Protocol (alias of objc_protocol, not a pointer)
Makes it possible to assign which pointers are mutable and which are immutable.
Also remove redundant (the original) function definitions
Makes it possible for downstream users to customize the linking to libobjc, see https://doc.rust-lang.org/cargo/reference/build-scripts.html#overriding-build-scripts
This is the lowest version we'll target because they added support for the `objc_msgSend` family of functions which we might want to use (instead of the current `objc_msg_lookup`). Alternatively we could have chosen v1.6, but they're both from 2013 so it's kinda moot at this point. v1.5 is missing lots of functionality. Commit gnustep/libobjc2@50a797f
This can be used to see the main differences in the objc API from v1.7 to v2.1; in essence, the API we'll be using haven't actually changed! Commit gnustep/libobjc2@282486d
Also add objc_retainAutoreleaseReturnValue that I missed in 052bcd6
Probably all of the underlying APIs can handle NULL values, so not having this possibility is restricting. And most of them can sometimes _return_ a NULL value, so not handling that is unsound!
d48774a to
85254d8
Compare
It's unclear how much these are part of the ABI stability, and whether they're actually useful
Owner
Author
|
Wow, this took wayyy longer to make than the few hours I had anticipated! |
15 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new crate called
objc_sys, which is like the oldobjc::runtimebut only containing raw bindings, making it usable by other libraries likefruity.Because it has the
linkskey inCargo.toml, it's now possible for downstream users to customize the linking tolibobjc, see the cargo section on Overriding Build Scripts.To create these bindings I've used
bindgento help me out, though I've had to modify them a lot manually because I wanted to have better*constvs.*mutpointer declarations (and had to ensure that the bindings were available on previouslibobjcversions).The fact that Apple has put their
libobjcas open source has been really helpful. See their website and mygitmirror.TODO:
Check GCC headers through.We're not gonna be supporting that since it doesn't have ARC.objc_sysobjc-abi.hand add missing symbolsAdd feature to vendor GNUStep'sPostponed, see README.libobjc2?Differentiate between ABI and runtime?Not that important in documentation.Set upPostponed, see README.cccompilers (clang,gcc, ...?) to use the correct runtime.AddPostponedobjc_block_syscrate.