Translate-C & Objective-C

Hi all,

Does Zig’s Translate-C work with Objective-C? I tried to translate an Objective-C library (AVFoundation) and I got a TON of errors.

/Applications/ error: expected identifier or '('
@class NSString, Protocol;

/Applications/ error: unknown type name 'NSString'
typedef NSString * NSExceptionName NS_TYPED_EXTENSIBLE_ENUM;

… among other similar errors.

Does this mean that Zig Translate-C doesn’t support Objective-C?

Objective-C is a different language than C, and I don’t believe there’s any support for it.

Oh, got it. Thanks

You can use Zig (zig cc) to compile ObjectiveC code, and then you can link against it, but it can’t be translated to Zig code directly.

Related tweet: