2 #include "swift-class-def.m"
4 @interface SwiftDylib1A: NSObject @end
5 @interface SwiftDylib1B: NSObject @end
7 @interface NSObject (DylibCategories)
8 - (char *)dylib1ACategoryInSameDylib;
9 - (char *)dylib1BCategoryInSameDylib;
10 - (char *)dylib1ACategoryInOtherDylib;
11 - (char *)dylib1BCategoryInOtherDylib;
12 - (char *)dylib1ACategoryInApp;
13 - (char *)dylib1BCategoryInApp;
14 + (void)testFromOtherDylib;
17 @implementation SwiftDylib1A (Category)
18 - (const char *)dylib1ACategoryInOtherDylib { return "dylib1ACategoryInOtherDylib"; }
20 @implementation SwiftDylib1B (Category)
21 - (const char *)dylib1BCategoryInOtherDylib { return "dylib1BCategoryInOtherDylib"; }
24 SWIFT_STUB_CLASSREF(SwiftDylib1A);
25 SWIFT_STUB_CLASSREF(SwiftDylib1B);
27 Class objc_loadClassref(_Nullable Class * _Nonnull clsref);
29 @implementation SwiftDylib1A (Test)
30 + (void)testFromOtherDylib {
31 Class SwiftDylib1A = objc_loadClassref(&SwiftDylib1AClassref);
32 Class SwiftDylib1B = objc_loadClassref(&SwiftDylib1BClassref);
33 testassert(strcmp([[SwiftDylib1A new] dylib1ACategoryInSameDylib], "dylib1ACategoryInSameDylib") == 0);
34 testassert(strcmp([[SwiftDylib1B new] dylib1BCategoryInSameDylib], "dylib1BCategoryInSameDylib") == 0);
35 testassert(strcmp([[SwiftDylib1A new] dylib1ACategoryInApp], "dylib1ACategoryInApp") == 0);
36 testassert(strcmp([[SwiftDylib1B new] dylib1BCategoryInApp], "dylib1BCategoryInApp") == 0);
37 testassert(strcmp([[SwiftDylib1A new] dylib1ACategoryInOtherDylib], "dylib1ACategoryInOtherDylib") == 0);
38 testassert(strcmp([[SwiftDylib1B new] dylib1BCategoryInOtherDylib], "dylib1BCategoryInOtherDylib") == 0);