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 @interface DyldClass : NSObject
13 @implementation DyldClass
14 -(void) dyldClassFoo {
17 +(void) dyldClassFoo {
22 @interface DyldMainClass : NSObject
25 @implementation DyldMainClass
26 -(void) dyldMainClassFoo {
29 -(void) dyldMainClassFoo2 {
34 extern int printf(const char*, ...);
36 extern id objc_getClass(const char *name);
39 printf("[BEGIN] _dyld_get_objc_selector\n");
42 const char* sel = _dyld_get_objc_selector("dyldClassFoo");
44 if ((SEL)sel != @selector(dyldClassFoo)) {
45 printf("[FAIL] _dyld_get_objc_selector: dyldClassFoo is wrong\n");
51 sel = _dyld_get_objc_selector("dyldMainClassFoo");
53 if ((SEL)sel != @selector(dyldMainClassFoo)) {
54 printf("[FAIL] _dyld_get_objc_selector: dyldMainClassFoo is wrong\n");
60 sel = _dyld_get_objc_selector("dyldMainClassFoo2");
62 if ((SEL)sel != @selector(dyldMainClassFoo2)) {
63 printf("[FAIL] _dyld_get_objc_selector: dyldMainClassFoo2 is wrong\n");
68 printf("[PASS] _dyld_get_objc_selector\n");