Firstly, if you use a framework or API (for example, using wxWidgets instead of manually rendering Windows or the GNU C library), your code wraps between different operating systems.
Secondly, if you use the APIs, you will not have problems if the manufacturer changes the operation of the operating system under the hood, since the API (should) be the same as before.
source share