What are the differences between .so and .dylib on macOS?

.dylib is the dynamic library extension on macOS, but it’s never been clear to me when I can’t / shouldn’t use a traditional unix .so shared object.

Some of the questions I have:

  • At a conceptual level, what are the main differences between .so and .dylib?
  • When can/should I use one over the other?
  • Compilation tricks & tips (For example, the replacement for gcc -shared -fPIC, since that doesn’t work on osx)

4 Answers
4

Leave a Comment