2 // BUILD: $CC main.m -o $BUILD_DIR/_dyld_get_objc_selector.exe -lobjc
4 // RUN: ./_dyld_get_objc_selector.exe
6 #include <mach-o/dyld_priv.h>
8 #import <Foundation/Foundation.h>
10 #include "test_support.h"
12 @interface DyldClass : NSObject
15 @implementation DyldClass
16 -(void) dyldClassFoo {}
17 +(void) dyldClassFoo {}
20 @interface DyldMainClass : NSObject
23 @implementation DyldMainClass
24 -(void) dyldMainClassFoo {}
25 -(void) dyldMainClassFoo2 {}
28 extern id objc_getClass(const char *name);
30 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
32 const char* sel = _dyld_get_objc_selector("dyldClassFoo");
34 if ((SEL)sel != @selector(dyldClassFoo)) {
35 FAIL("dyldClassFoo is wrong");
40 sel = _dyld_get_objc_selector("dyldMainClassFoo");
42 if ((SEL)sel != @selector(dyldMainClassFoo)) {
43 FAIL("dyldMainClassFoo is wrong");
48 sel = _dyld_get_objc_selector("dyldMainClassFoo2");
50 if ((SEL)sel != @selector(dyldMainClassFoo2)) {
51 FAIL("dyldMainClassFoo2 is wrong");
55 PASS("_dyld_get_objc_selector");