We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When importing objc/runtime.h and/or objc/message.h the compiler detects a dependency loop.
objc/runtime.h
objc/message.h
const objc = @cImport({ @cInclude("objc/runtime.h"); @cInclude("objc/message.h"); }); pub fn main() void { const value: objc.id = undefined; }
The problem is caused by these definitions:
pub const Class = [*c]struct_objc_class; pub const struct_objc_class = extern struct { isa: Class, super_class: Class, name: [*c]const u8, version: c_long, info: c_long, instance_size: c_long, ivars: [*c]struct_objc_ivar_list, methodLists: [*c]([*c]struct_objc_method_list), cache: [*c]struct_objc_cache, protocols: [*c]struct_objc_protocol_list, };
which can be fixed by using @This() to reference the struct itself:
@This()
pub const struct_objc_class = extern struct { isa: [*c]@This(), super_class: [*c]@This(), // [...] };
Another offender is this definition:
pub const struct_objc_object = extern struct { isa: Class, }; pub const id = [*c]struct_objc_object; pub const IMP = ?extern fn (id, SEL, ...) id;
A Class has a method list with IMPs, which causes the dependency loop.
Class
IMP
Here's a hacky fix for that, but I would prefer not to loose type safety. Is there a better workaround?
pub const struct_objc_object = extern struct { isa: *c_void, };
Edit: I am running macOS 10.14
The text was updated successfully, but these errors were encountered:
This sounds like it will be fixed by #2174 which is still planned for this release cycle.
Sorry, something went wrong.
Alright, does the *c_void fix have an consequences other than loosing type safety? Is the information relevant for linking et al.?
*c_void
I believe this was fixed by #2174. Please let me know if it is not.
No branches or pull requests
When importing
objc/runtime.h
and/orobjc/message.h
the compiler detects a dependency loop.The problem is caused by these definitions:
which can be fixed by using
@This()
to reference the struct itself:Another offender is this definition:
A
Class
has a method list withIMP
s, which causes the dependency loop.Here's a hacky fix for that, but I would prefer not to loose type safety. Is there a better workaround?
Edit: I am running macOS 10.14
The text was updated successfully, but these errors were encountered: