Created
February 5, 2018 03:53
-
-
Save zhaorui/49b9f6e2bcd3790b2f5ae13d96104148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *dylibPath = @"/Users/billzhao/Desktop/libRulesActions.dylib"; | |
const char *libPath = [dylibPath cStringUsingEncoding:NSUTF8StringEncoding]; | |
void *dl = dlopen(libPath, RTLD_NOW); | |
const char *dlErr = dlerror(); | |
if (dlErr) { | |
NSLog(@"dlerror() = %s", dlErr); | |
} else { | |
NSLog(@"dylib path is %s, dl = %p", libPath, dl); | |
} | |
// Get the Person class (required with runtime-loaded libraries). | |
Class RulesActions_class = objc_getClass("RulesActions"); | |
if (!RulesActions_class) { | |
NSLog(@"[%s] main: Unable to get RulesActions_class class", __FILE__); | |
exit(EXIT_FAILURE); | |
} | |
// Create an instance of Person. | |
NSLog(@"[%s] main: Instantiating RulesActions_class", __FILE__); | |
RulesActions* person = [[RulesActions_class alloc] init]; | |
NSLog(@"%@", person); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment