开发者

theos creat a dylib,not tweak

开发者 https://www.devze.com 2023-04-04 16:26 出处:网络
I notice theos could build library and produce dylib, I try the simple code like static UIAlertView *alert_view;

I notice theos could build library and produce dylib, I try the simple code like

static UIAlertView *alert_view;
static void showAlert() {
    alert_view = [[UIAlertView alloc] initWithTitle:@"Welcome" 
                                                    message:@"Welcome to your iPhone Brandon!" 
                                                   delegate:nil 
                                          cancelButtonTitle:@"Thanks" 
                                          otherButtonTitles:nil];
    [alert_view show];
    [alert_view release];
}

after make I got a dylib, but I try to build a test project to use this dylib, failed. My test code like

void* sdl_library = dlopen("/tmp/AlertDylib.dylib", RTLD_LAZY);
if(sdl_library == NULL) {
    NSLog(@"fail load");
} else {
    // use the result in a call to dlsym
    void* showAler开发者_运维技巧t = dlsym(sdl_library,"showAlert");
    if(showAlert == NULL) {
        NSLog(@"fail got function");
    } else {
        // cast initializer to its proper type and use
    }
}

I'm sure I put dylib file under /tmp/, but log said "fail got function", any steps I missed?

0

精彩评论

暂无评论...
验证码 换一张
取 消