Topic: Third party library compatibility


Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/05/30
Raw View
In article 95May30143333@typhoon, smk@cadre.com (Stephen M. Kafka) writes:
>
>
>A question concerning the compatibility of standard libraries delivered
>by more than one compiler vendor.
>
>Assuming that both compiler vendors conform to a well-specified object
>layout specification (I am aware of a couple of these defacto-standard
>"C++ ABI"s) for a given architecture, is the standard then prophesying
>that both vendors' standard library implementations will be compatible ?

No.

If both implementations conform to the C++ standard and both conform to the
same ABI, and if your code conforms to the standard, then you should be able
to use the headers and library from either vendor in building your program.

You should not expect to be able to compile against the headers for library
A and link with library B. The standard allows considerable freedom in
implementation details which might not be addressed by any ABI, apart
from the two libraries having different extensions. (Trivial example:
the values of the constants describing stream state are not defined in
the standard.)

>I'm concerned with both
>
>   a. The object layout. Are the members of the class(es) involved specified
>      such that all data members will occupy the same position within the class
>      layout ?

Absolutely not. The private portions of the classes are not specified at all.

>
>   b. The run time behavior of the two iostreams. Are they mix and
>      matchable ?

The standard requires a certain public interface with certain semantics.
Some details are implementation-defined, unspecified, or undefined.
Implementors may add extensions in ways that don't break programs that
depend only on the parts defined in the standard.

If you write code that depends only on the public interface and the fully-
defined behavior, you code should be portable. Practically speaking, few
programs meet this requirement. Too many details of the OS intrude.

---
Steve Clamage, stephen.clamage@eng.sun.com







Author: smk@cadre.com (Stephen M. Kafka)
Date: 1995/05/30
Raw View

A question concerning the compatibility of standard libraries delivered
by more than one compiler vendor.

Assuming that both compiler vendors conform to a well-specified object
layout specification (I am aware of a couple of these defacto-standard
"C++ ABI"s) for a given architecture, is the standard then prophesying
that both vendors' standard library implementations will be compatible ?

For example, if CompilerVendor A delivers an iostream implementation and
ThirdPartyVendor A then uses CompilerA to deliver product *and* the
user of that product is developing product using CompilerVendor B technology,
will the two iostreams be compatible ?

I'm concerned with both

   a. The object layout. Are the members of the class(es) involved specified
      such that all data members will occupy the same position within the class
      layout ?

      That there is absolutely no question of how a standard library class is
      exactly defined ?

   b. The run time behavior of the two iostreams. Are they mix and
      matchable ?


(I didn't see an answer to this in the FAQ)