I know that passing objects to/from DLLs can be unsafe, but I am unsure if the same is true for static libraries.
Is it safe to pass objects, such as STL objects, to and from a static library?
It better be. A static library is essentially just a bunch of compiled object files mushed together and indexed to simplify linking; if it wasn't safe to pass STL objects to a static library, it wouldn't be safe to pass them between functions defined in separate .cpp
files at all.
Obviously, you need to make sure the static library was compiled with a compiler using the same ABI as the one you eventually compile and link your own code with, but there isn't the issue with linking different runtime libraries that occurs with dynamic linkage.