I have some shared objects which have to be compiled with g++4.5, and I would like the开发者_如何学Gom to be able to be linked into applications compiled using g++4.1 and g++4.2.
It's my understanding that their is no guarantee that the different versions of libstdc++ will be compatible with each other so this won't work without some changes.
Is there a standard way to do this short of installing a newer version of g++ and it's related libraries on the target machines?
As long as the architecture is the same, and you are not using features exclusive to the newer version, the shared objects should work fine.
How about just testing it and seeing if it works (with mismatched GCC versions)? If it works, no need to go to any particular trouble about it. That is, unless you're dealing with life-support systems here, but I'm guessing not.
You're more likely to have problems in practice if STL containers and such are passed through the libraries' APIs. If the libraries use the STL internally only, it could "just work."
精彩评论