Cause
The problem occurs due to a "shortcut" used with compilers for many common object-oriented (OO) languages, a design feature that was kept when OO languages were evolving from earlier non-OOthisPerson.middleInitial
which the compiler turns into something like a = location(thisPerson) + offset(middleInitial)
. Modern CPUs typically include instructions for this common sort of access.
When object-oriented language compilers were first being developed, much of the existing compiler technology was used, and objects were built on top of the record concept. In these languages the objects were referred to by their starting point, and their public data, known as "fields", were accessed through the known offset. In effect the only change was to add another field to the record, which is set to point to an immutable Symptoms
This leads to a problem in largerdoSomething
to doSomethingElse
that it might cause a problem, but in this case one can cause problems without changing doSomething
, it can be caused as easily as moving lines of source code around for clarity. Worse, the programmer has little or no control over the resulting layout generated by the compiler, making this problem almost completely hidden from view.
In complex object-oriented Solutions
Languages
One solution to the fragile binary interface problem is to write a language that knows the problem exists, and does not let it happen in the first place. Most custom-written OO languages, as opposed to those evolved from earlier languages, construct all of their offset tables at load time. Changes to the layout of the library will be "noticed" at that point. Other OO languages, likeLinkers
Another solution requires a smarter linker. In the original version ofArchitecture
In these languages the problem is lessened by enforcingDistribution method
The whole problem collapses if the source code of the libraries is available. Then a simple recompilation will do the trick.See also
*External links
* BeOS'sbr>paper