-1

I have a simple C library that I compile to a .so file on my linux machine. I'd like to do the same on my Mac, but after I compile and move the library to /usr/local/lib, but I'm not sure how to link it seeing as ldconfig isn't a thing.

How would I go about doing this?

BarFooBar
  • 1,086
  • 2
  • 13
  • 32
  • You'd start by reading the [documentation](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/000-Introduction/Introduction.html). – trojanfoe Nov 07 '15 at 01:50

1 Answers1

1

While Linux has .so files, OSX has .dylib files. The process is similar, you just invoke compiler as in

clang -dynamiclib -o libname.dylib sources.c
Jack
  • 131,802
  • 30
  • 241
  • 343
  • Yes, but `.so` files are executable on osx as well are they not? I have several in `/usr/local/lib` on OSX right now. – BarFooBar Nov 07 '15 at 02:02
  • Check this answer: http://stackoverflow.com/questions/2339679/what-are-the-differences-between-so-and-dylib-on-osx – Jack Nov 07 '15 at 02:03