简体   繁体   中英

SDL2 Backward Compatibility Guarantees?

SDL2 is often described as breaking backwards compatibility with SDL 1.2.

This implies that within different versions of SDL2, the API and ABI remain backwards-compatible.

However, I have not been able to find any authoritative source confirming that this is the case.

For example, for GLIBC, Red Hat maintains a webpage which states:

One of the GNU C Library's (glibc's) unwritten rules is that a program built against an old version of glibc will continue to work against newer versions of glibc.

This guarantee is very useful for portability, as it means that a program can be compiled against an older version of GLIBC and run on any platform that ships at least that version or any newer version of GLIBC.

The closest to such a guarantee that I have been able to find for SDL2 are the release notes for Py SDL2 , a separate project, which make passing references to "backwards compatibility":

Improved compatibility with older SDL2 releases […]

[…] properly wrapped now to retain backwards compatibility with previous SDL2 releases

[…] provide backwards compatibility for previous SDL2 releases […]

There are also two issues on Github which make passing mentions to "backwards compatibility" in the context of using SDL2, but also aren't actually directly tied to the SDL library at all.


Is there any official or authoritative source documenting or guaranteeing backwards compatibility across different versions of SDL2?

IE, If I compile a program to dynamically link against an older version of SDL2, is it safe to assume that it will work on platforms that provide a newer version of SDL2?

Official Statements

It appears that one of the first goals reached in the development of SDL2 was to stabilize the ABI, explicitly so that no breaking changes would happen to it until SDL 3, according to the original author and main developer of SDL:

slouken Regular Mar '13

As of tonight, SDL 2.0 is ABI locked!

This means that no breaking changes will happen to the API until SDL 3.

Cheers!

From the SDL wiki :

We are obsessive about SDL2 having a backwards-compatible ABI. Whether you build your game using the Steam Runtime SDK or just about any old copy of SDL2, it should work with the one that ships with Steam.

A similar process is planned for the development of SDL 3:

slouken commented 22 days ago (4 Oct 2022, 18:45 GMT)

Our current plan is to make all the ABI breaking changes immediately before the very first SDL3 release, so we have a stable ABI from the very beginning.

Empirically

If we go on abi-laboratory.pro , we may see that SDL2 has more or less kept its promise of perfect ABI compatibility throughout every release:

在此处输入图像描述

Source

Specific changes between each version can furthermore be reported by clicking on the percentages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM