-
Notifications
You must be signed in to change notification settings - Fork 44
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 objc_sys
crate
#19
Merged
Merged
Conversation
This file contains 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
madsmtm
force-pushed
the
sys-crates
branch
4 times, most recently
from
September 4, 2021 14:47
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!
madsmtm
force-pushed
the
sys-crates
branch
3 times, most recently
from
September 6, 2021 07:08
d48774a
to
85254d8
Compare
It's unclear how much these are part of the ABI stability, and whether they're actually useful
Wow, this took wayyy longer to make than the few hours I had anticipated! |
15 tasks
Merged
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::runtime
but only containing raw bindings, making it usable by other libraries likefruity
.Because it has the
links
key 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
bindgen
to help me out, though I've had to modify them a lot manually because I wanted to have better*const
vs.*mut
pointer declarations (and had to ensure that the bindings were available on previouslibobjc
versions).The fact that Apple has put their
libobjc
as open source has been really helpful. See their website and mygit
mirror.TODO:
Check GCC headers through.We're not gonna be supporting that since it doesn't have ARC.objc_sys
objc-abi.h
and 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.cc
compilers (clang
,gcc
, ...?) to use the correct runtime.AddPostponedobjc_block_sys
crate.