theos creat a dylib,not tweak
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?
精彩评论