I have some compatibility concerns around the building of a C++ library with a modern version of GCC 4.4.x/4.5.x whereby clients on an older version, say 3.4.x/4.1.x. One solution which has been suggested is to compile the object files and distribute these. Clients can then link using any version of GCC and the relevant ABI. Some questions:
Cheers, Graeme
The safest would be to give them a .so and its corresponding header with the stable binary API. To be binary stable that API should not accept or return any std::
types like std::string
or std::vector<>
because the binary layout of std::
types may change from version to version.
And it should be linked statically with libstdc++ and libgcc_s, so that your clients don't have to link against a particular version of libstdc++.
You can also pack all your .o files into one .a for convenience, so that when you add a new .o file your clients don't have to update their makefiles to link against the new .o.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With