link compat=4 built library with a compat=5 build code

link compat=4 built library with a compat=5 build code

Post by melissa_benk » Sun, 07 Mar 2004 00:45:24



Hello all,

Is it possible to link a library built on a compat=4 option with
source code that is built using compat=5. The source code needs to be
built with compat=5 because it uses stl (like map, string, etc).

thanks in advance for any help.

mel

 
 
 

link compat=4 built library with a compat=5 build code

Post by Seongbae Par » Sun, 07 Mar 2004 03:46:23



> Hello all,

> Is it possible to link a library built on a compat=4 option with
> source code that is built using compat=5. The source code needs to be
> built with compat=5 because it uses stl (like map, string, etc).

No. Please RTFM.

From http://docs.sun.com/source/817-0925/Ch1.Intro.html

1.2 Compiler Modes of Operation

   The C++ compiler has two modes of operation, standard mode and
   compatibility mode.

  1.2.1 Standard Mode

   Standard mode implements most of the C++ International Standard,
   and has some source incompatibilities with the language accepted
   by C++ 4, as noted earlier.

   More importantly, in standard mode, the C++ 5 compilers use an
   application binary interface (ABI) different from that of C++ 4.
   Code generated by the compiler in standard mode is generally
   incompatible with, and cannot be linked with, code from the
   various C++ 4 compilers. This subject is discussed in more detail
   in Section 1.3, Binary Compatibility Issues.

   You should update your code to compile in standard mode, for
   several reasons:

     * Compatibility mode is not available for 64-bit programs.

     * You can't use important standard C++ features in compatibility
     mode.

     * New code written to the C++ standard might not compile in
     compatibility mode, meaning you can't
       import future new code into the application.

     * Since you can't link 4.2 and standard-mode C++ code together,
     you might need to maintain two
       versions of object libraries.

     * Compatibility mode will not be supported forever.

Seongbae