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/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:601:1: error: expected identifier or '('
@class NSString, Protocol;

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:603:9: 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:

https://twitter.com/mitchellh/status/1610051345981267969