Maison > Questions et réponses > le corps du texte
#import <UIKit/UIKit.h>
#import <dlfcn.h>
static void (*block_func)(void);
dispatch_block_t block = ^(){
printf("Hello, World!\n");
};
void test(){
printf("test invoked\n");
}
int main(int argc, char *argv[]) {
for (NSInteger i = -2000; i < 2000; i++) {
block_func = dlsym(i, "test");
if (block_func) {
printf("%ld\n", (long)i);
block_func();
}
block_func = dlsym(i, "main_block_invoke");
if (block_func) {
printf("%ld\n", (long)i);
block_func();
}
}
}