Content deleted Content added
No edit summary Tags: Reverted Mobile edit Mobile web edit |
m Reverted edits by 2600:1014:B07D:B5E5:899B:8B91:F76F:ED10 (talk) (AV) |
||
Line 60:
} else {
// use the result in a call to dlsym
}
</syntaxhighlight>
====macOS====
As a [[UNIX]] library:
<syntaxhighlight lang="c">
void* sdl_library = dlopen("libSDL.dylib", RTLD_LAZY);
if (sdl_library == NULL) {
// report error ...
} else {
// use the result in a call to dlsym
}
</syntaxhighlight>
As a [[Application framework|macOS Framework]]:
<syntaxhighlight lang="c">
void* sdl_library = dlopen("/Library/Frameworks/SDL.framework/SDL", RTLD_LAZY);
if (sdl_library == NULL) {
// report error ...
} else {
// use the result in a call to dlsym
}
</syntaxhighlight>
Or if the framework or bundle contains Objective-C code:
<syntaxhighlight lang="objc">
NSBundle *bundle = [NSBundle bundleWithPath:@"/Library/Plugins/Plugin.bundle"];
NSError *err = nil;
if ([bundle loadAndReturnError:&err])
{
// Use the classes and functions in the bundle.
}
else
{
// Handle error.
}
</syntaxhighlight>
|