Monday December 04, 2006
What About Binary Compatibility?
»What will happen if I try to run my application on a newer Solaris OS release?
»What will happen if I try to compile my application using one version of the Sun Studio compilers and link it with libraries compiled with earlier compiler versions?
Important questions to consider, and luckily both Solaris and the Sun Studio compilers guarantee a certain degree of binary compatibility between releases.
Here are some things to keep in mind
f95
compiler
are not guaranteed to be compatible
with future releasesSpecific Questions I get often:
»Can I compile my application on Solaris 10 and run it on Solaris 9 and Solaris 8?
No. Might work, but since you compiled it on Solaris 10, it might also be using system interfaces that did not exist on Solaris 8 and 9 or have changed in Solaris 10.
»Can I compile my application on Solaris 8 and run it on Solaris 9 and Solaris 10?
Yes! This is what binary compatibility is all about. (See above)
»Can I compile and build my shared library on Solaris 10 and use it on Solaris 9 and Solaris 8?
No. Might work, but since you compiled it on Solaris 10, it might also be using system interfaces that did not exist on Solaris 8 and 9 or have changed in Solaris 10.
»If I compile the code in my shared library using the Sun Studio 11 compilers, can my customers who are still using Forte 6 Update 1 compilers link with these shared libraries?
No. You must always link with the same compiler used to create the newest objects in your application or library. So, if Sun Studio 11 compilers are used to compile the code in a shared library, Sun Studio 11 compilers must be used when linking with that shared library.
That last one is incorrect, for C anyways. The Solaris C ABI is well defined and adhered to by Sun C compilers and GCC, so you can use shared objects built with one compiler from objects/programs built with another. If this was not the case we'd have to have multiple versions of all of our shared libraries, each built with different compilers. Clearly we don't do that, because we don't have to, because this just works.
The same is not true for C++ AFAIK though.
Posted by Nico on December 05, 2006 at 02:12 PM PST #
Posted by luoyi82 on December 05, 2006 at 05:40 PM PST #
That's not what you wrote above.
You wrote: "If I compile the code in my shared library using the Sun Studio 11 compilers, can my customers who are still using Forte 6 Update 1 compilers link with these shared libraries?"
Clearly this has nothing to do with "earlier platform" as you could use Forte 6 Update 1 on S10, no?
Posted by Nico on December 06, 2006 at 10:17 AM PST #