Home >Backend Development >C++ >.so vs. .dylib in macOS: When to Use Which Shared Library Type?
Mach-O, the object file format in macOS, differentiates between shared libraries (.dylib) and dynamically loaded modules (bundles). Shared libraries are linked during compilation and can be referenced using -lfoo flags. Bundles, on the other hand, are plug-ins that extend applications and link against their exported API.
In early macOS versions, bundles were used for dynamic loading, while dylibs were introduced later. However, with macOS 10.5, both dylibs and bundles could be dynamically loaded using the dl APIs.
"Bundle" can also refer to directories with standardized structures containing code and resources. This concept is similar to Mach-O bundles used as plugins, but they should not be confused with each other.
The above is the detailed content of .so vs. .dylib in macOS: When to Use Which Shared Library Type?. For more information, please follow other related articles on the PHP Chinese website!