I'm planning to release some compiled code that shall be linked by client applications on MacOSX.
The distribution is some kind of code library and a set of header files defining the public interface for the library.The code is internally C++ but its public interface (i.e what's being shown in the headers) is completely C.
These are my requirements or atleast what I hope I can accomplish:
- I want my library to be as agnostic as possible for what version of OSX and GCC the user is running. Having separate libraries for 64 bit and 32 bit is okay though.
- I want my library to be loadable from languages that supports loading C libraries such as python or similar.
- I want my libraries internal symbols to be isolated from the code it's being linked into. I don't want to have duplicate symbol errors because we happen to name an internal function in the same way. My C++ code is properly namespaced so this may not be as big of an issue though, but some of the libraries I depend on is C and can be an issue (see next point).
- I want my library dependencies to be safe. My library depends on some libraries such as libpng, boost and stl and I don't want issues because some users don't necessarily have all of them installed or get problems because they have been compiled with other flags or have different versions than I have.
On Windows I use a DLL with an export library and link all my dependencies statically into the dll. It fulfills all the criteria above and if I can get the same result on OSX it would be great, however I've heard that dynamic libraries tend not to isolate symbols on mac in the same way.
Is there some kind of best practice for this on OSX?