theos 创建一个 dylib,而不是调整
我注意到 theos 可以构建库并生成 dylib,我尝试了简单的代码,例如
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];
}
make 之后我得到了一个 dylib,但我尝试构建一个测试项目来使用这个 dylib,失败了。 我的测试代码就像
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* showAlert = dlsym(sdl_library,"showAlert");
if(showAlert == NULL) {
NSLog(@"fail got function");
} else {
// cast initializer to its proper type and use
}
}
我确定我将 dylib 文件放在 /tmp/ 下,但日志显示“功能失败”,我错过了任何步骤吗?
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* showAlert = 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论