Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the NSBundle's -load method register classes and other runtime resources with the Objective-C runtime?

Foundation's NSBundles are the best way to load dynamic code in Objective-C. The -load method dynamically loads the bundle's executable code into a running program.

But, which Objective-C runtime public function does the NSBundle's -load method use to load a dynamic library and register classes, categories, protocols, methods, selectors, etc, with the Objective-C runtime? In which header is it declared?

like image 657
LuisABOL Avatar asked Nov 02 '25 07:11

LuisABOL


1 Answers

NSBundle doesn't use the ObjC runtime for that. It uses dlopen, and the dynamic linker handles loading things.

like image 177
Catfish_Man Avatar answered Nov 04 '25 06:11

Catfish_Man



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!