Answer the question
In order to leave comments, you need to log in
How are compilations made for different platforms?
As I understand it, if you write a program, for example, in C ++, then it is quite possible to compile it for different platforms: Windows, Linux, Mac, Android, but then an abstraction layer is needed. Does this layer mean accessing the API through the function that corresponds to the given one on the required platform? Relatively speaking: Windows has function a to display the window, Linux has function b, and you need to select the appropriate one on each platform. It turns out that it is enough to replace such functions, choose another compiler and the program for another platform is ready? If so, why can't one programming language be used everywhere?
Answer the question
In order to leave comments, you need to log in
Firstly, "use the same programming language" and cross-platform are two different things . Parallel.
Languages have their pros and cons (and this is regardless of cross-platform). Otherwise, long ago there would have been a single language . Ideal. At least within the same platform . But no. Languages continue to appear.
And now about cross-platform:
Platforms are very different.
Well, tell me, why do you need a "window API" for a server platform where there is no GUI?
There are attempts to write a universal solution. But we get limited functionality somewhere. Not taking into account the nuances anywhere. Because you can not embrace the immensity.
You forgot that desktop on Linux can be very, very different.
And even for Linux there is no normal cross-platform GUI.
Why not.
Can.
In JavaScript or with QT or use the JDK.
However, the applicability of these solutions is limited. There are a lot of places where they do not fit perfectly and do not fit all the details of the platform.
Also, one single platform is the death of development.
After all, new platforms appear not just because someone is not sorry for their creation of billions.
That's pretty much how they do it.
But, however, it's good if you can "call one function" at all.
You are assuming that someone is designing a platform as a convenient way to further implement cross-platform.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question