Adam
Adam

Reputation: 21

Using shared objects compiled with a newer version of g++

I have some shared objects which have to be compiled with g++4.5, and I would like them 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?

Upvotes: 2

Views: 187

Answers (2)

karlphillip
karlphillip

Reputation: 93478

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.

Upvotes: 1

John Zwinck
John Zwinck

Reputation: 249642

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."

Upvotes: 0

Related Questions