No, and No.
The compatibility rule is that code compiled on an earlier version of Solaris can be run on a later version of Solaris (with some limitations), but not the other way around.
The reason is that code compiled on later versions of Solaris typically rely on interfaces that do not exist in earlier versions of Solaris. Later versions of Solaris preserve older interfaces, to allow old code to continue to run.
Limitations on using binaries on later Solaris versions are that all system libraries must be linked dynamically (using the shared rather than the archive version of libraries), and that only documented public interfaces be used. Sun provides the AppCert program to verify that you use only public interfaces.
Similar compatibility rules apply to compiler versions: You can usually link to a binary created by an older compiler, but you cannot expect to link a binary from a newer compiler into a program built with an older compiler. The reasons are the same -- reliance on newer interfaces.
So the rule for developers is to decide on the earliest Solaris version that you intend to allow your customers to use, and build on that version.
If you supply libraries, build them with the earliest compiler that you intend to allow your customers to use.
Your customers can then use your binaries on the same or later versions of Solaris, and use your libraries with the same or later compiler versions.
For completeness, you would want to test with all the later Solaris and compiler versions.
I had similar problem. Check these flags in documentation:
-xnolib
-B[i]binding[/i]
Problem with old math library i solved with something like this:
-xnolib /lib/libm.so.1 -lCstd -lCrun -lc
I know thats not nice to use /lib/libm.so.1 directly, but it worked.
C++ libraries was possible to link staticly (-Bstatic) to program i think. Maybe you can link staticly all, but program will be to big. Just try some possibilities :).
Do NOT link C++ runtime or system libraries statically. There are a few restricted cases where it may work. Real-world applications are likely to fail when using static system libraries.
If your application uses C++ shared libraries, or runs on different OS versions, it is likely to fail unless all C++ and system libraries are linked dynamically.
I think that if you use C++ only inside your program and outside communicate only with C functions, then you can staticly link C++ libraries without worry. Other libraries should be linked dynamicly, but you can replace link to the right version, which is on solaris 10 too(math library). Maybe im wrong but i think that this way it can work.