Skip to content

Instantly share code, notes, and snippets.

@yingkong1987
Created March 10, 2014 12:31
Show Gist options
  • Save yingkong1987/9464193 to your computer and use it in GitHub Desktop.
Save yingkong1987/9464193 to your computer and use it in GitHub Desktop.
动态添加reveal库
- (void)loadReveal
{
NSString *revealLibName = @"libReveal";
NSString *revealLibExtension = @"dylib";
NSString *dyLibPath = [[NSBundle mainBundle] pathForResource:revealLibName ofType:revealLibExtension];
DLog(@"Loading dynamic library: %@", dyLibPath);
void *revealLib = NULL;
revealLib = dlopen([dyLibPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);
if (revealLib == NULL)
{
char *error = dlerror();
NSLog(@"dlopen error: %s", error);
NSString *message = [NSString stringWithFormat:@"%@.%@ failed to load with error: %s", revealLibName, revealLibExtension, error];
[[[UIAlertView alloc] initWithTitle:@"Reveal library could not be loaded" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment