What programming languages support Linux and Windows?

Asked

Viewed 1,007 times

20

The question is already in the title, however to make it clearer:

  • What languages I write a single code in, and run on both Linux and Windows?

Example

  • C. Except some commands like system("cls"); system("clear");.
  • Java. Virtual machine to interpret.

Obs

  • Languages running a task or window on the operating system.
  • I think the question is a little wide. Just by the question, php, javascript would also serve as an answer, even if web, until C#.

1 answer

19


Essentially all. In fact it is an exception to have languages that run only in one of them and not in the other, in general few known languages. The biggest exception might be Delphi. Even so it is possible to use Lazarus which uses almost identical language but which requires many changes in several cases.

The language itself has little to do with the operating system. It may have more restriction on the running processor, since the language either needs to generate code native to a specific processor or it needs to have an interpreter or virtual machine for that processor. There are some languages that confuse its basic structure with what should be a library. Then it obviously complicates more.

Library

Of course, the basic language library needs to be able to perform certain operations that depend on the operating system. Almost all have abstractions or at least specific libraries that allow to do all the main tasks in the two operating systems. Eventually it will be necessary to make some adaptation to the specifics. Libraries that can abstract 100% use a "lowest common denominator" method, which does not give good results.

Some stand out more because they have better abstractions and a larger number of served Apis, whether in the standard library or recognized libraries that become almost standard. C and C++ with some specific libraries are known to serve both very well.

Implementations

Languages interpreted and running on virtual machines usually go very well also in both, this includes C#, VB.NET, Java, PHP, Pyhton, Ruby, Perl, JS, Lua, just to stay in the best known. What matters is to have the environment where they run well in the two operating systems.

There is a certain subjectivity in which it better meets both platforms at the same time. But every code that wants to run on more than one platform needs to be written thinking about it.

Note that we are talking about implementations of languages because I doubt that anyone makes a language that is specified to run on a single platform, it makes no sense.

  • That’s what I immediately thought, practically all modern.

  • Very good, I think the phrase that stands out the most "Every code that wants to run on more than one platform needs to be written thinking about this."

  • Delphi is on top of Object Pascal, which has Linux support.

  • 1

    They’re still servicing Kylix?

  • 1

    @Not for many years. In fact it was never given support in fact, never worked as it should and as no one wore, it was abandoned soon after. Anyway, despite having an equal language base, the applications could not be reused in fact, needed a whole rework.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.