Man, this is gonna reveal some ignorance. But here goes. Please correct me where I'm wrong
.so/.dylib/.dll's typically get linked at load time, right? Like we aren't all manually loading dylibs in our source code. I guess I'm surprised on a platform as locked down as ios that they even allow you to link anything at run time.
chatgpt gives me this snippet but I have no way of knowing if this is roughly how it would look.
Class SBApplication = objc_getClass("SBApplication");
SEL launchSel = sel_registerName("launch");
id app = [SBApplication getAppWithBundleID:@"com.example.app"];
You can put in an autoload section and the runtime linker will load it for you, but you absolutely can load a DLL and its symbol names at runtime. Usually this is done for boring reasons like compatibility with multiple versions of an external library.
Comments
Man, this is gonna reveal some ignorance. But here goes. Please correct me where I'm wrong
.so/.dylib/.dll's typically get linked at load time, right? Like we aren't all manually loading dylibs in our source code. I guess I'm surprised on a platform as locked down as ios that they even allow you to link anything at run time.
chatgpt gives me this snippet but I have no way of knowing if this is roughly how it would look.
Class SBApplication = objc_getClass("SBApplication");
SEL launchSel = sel_registerName("launch");
id app = [SBApplication getAppWithBundleID:@"com.example.app"];
objc_msgSend(app, launchSel);
You can put in an autoload section and the runtime linker will load it for you, but you absolutely can load a DLL and its symbol names at runtime. Usually this is done for boring reasons like compatibility with multiple versions of an external library.