Replies: 1 comment
-
I never used Objective C, but if you only need to wrap interfaces(functions) with built-in types. Extracting required info from ObjC headers should not be very hard. We have a step-by-step tutorial about how to use Clang APIs: and a very simple example of how to extract info from C++ headers: ObjC should be similar. The source of C generator is huge because it's tricky to handle forward declaration and nested/anonymous structs/unions. If you need to wrap those C code written in ObjC, you could define a new context and reuse those passes on demand: Clang.jl/src/generator/context.jl Line 80 in 5cc2252 |
Beta Was this translation helpful? Give feedback.
-
I would want to use Clang.jl for parsing Objective C headers and generating wrappers that use the
@objc
macro from ObjectiveC.jl (which is still under development). So going from:... to something like:
... or something like it. I'm still figuring out how I want the
@objc
macro to look like. Currently it looks completely different, e.g. for the above two functions it'd do@objc [NSConditionLock initWithCondition:condition]
and@objc [self tryLock]
, relying on run-time introspection to figure out the types of the arguments and return value, but we should be able to parse all that from the headers.Anyway, what would be the recommended way to tackle this? Writing a custom generator, I presume? Or can the existing C generator be repurposed? If not, is there an example of a minimal generator to start with (the C one is pretty huge)?
Beta Was this translation helpful? Give feedback.
All reactions