What technologies that make it easy to port applications to a wide range of operating systems should I evaluate?

I’m retired, I am starting part time study for a degree in mathematics and software development this year and I intend to write a collection of basic calculators in different languages and eventually start a GNU graphical calculator project in my favorite language. Take a moment to help me by listing some of the different technologies that are used to write for multiple operating systems simultaneously or that make it easy to port applications between different operating systems.

I am so far committed to writing a simple calculator in Swift which I am told will then compile for everything Apple and another in C++ with SDL bindings that I am told will be easy to port to all the major operating systems. Do you know of any other systems that I should use to write/port a third, fourth or fifth little calculator for/to a wide range of platforms?

If you are using C++, you should be able to compile on any OS so long as you are only using libraries supported by that OS. The whole idea behind C/C++ is ‘portable assembly’ that will compile anywhere.

Really, only a handful of languages are specific to only some OS. Often, it is just libraries that have limited support for different OS.


(Unrelated side note - If you are doing this as a way to learn C/C++, cool, but I generally recommend that people avoid C/C++ and use more modern languages unless their project truly needs to be written in C/C++. Rust is a nice alternative.)

As @JeremyLT said, the majority of languages you might learn (C, C++, Python, Java, JavaScript, etc) are going to be OS agnostic. Some will require compilation on the target OS, but overall it’s not usually a significant concern.

1 Like

@JeremyLT @ArielLeslie I had been led to believe that there is a lot of work involved in porting software to different operating systems and architectures. You guys are saying that I just need to find libraries that are available on all the platforms I am wanting to compile on? I was sort of expecting that if i took some care my projects would need little modification to compile on (Intel) Linux, MacOS and Windows but was worried that I would have to rewrite them almost completely for the ARM PC architectures and again for phones/tablets. You are telling me this is not the case?

If you are writing vanilla C/C++ or some other language, then there is not much effort in writing code for different operating systems. The goal of high level languages is to keep programmers from needing to worry about low level details.

If you are writing a complex application that uses libraries, it may be the case that those libraries are not available on every operating system.

You mention phones/tablets. Are you thinking about something like a smartphone app? In that case, something like node.js might be a better fit.

I’m not a pro in this realm by any means, but I’ll offer up some things I’ve ran into as a user that uses multiple platforms.

  1. Use the web - basically everything can connect and run to the web, as such using it as an “application delivery platform” can work quite well.

  2. Use virtualization of some kind - something like Docker, would abstract the system from the application your using. So as long as the system has Docker, it can run your app. There’s a saying with Docker, “it works on my machine, so lets ship my machine!”.

  3. Use tooling to target specific platforms at compile time - I know a language like Golang provide tooling to compile for different platforms. I would assume other popular languages have something similar, but I only know of this one.

If your sticking with Swift, I’d look into specific approaches for that language/tooling your used to. I’m not sure of the “portability” of those apps with that language, but I would assume there are some docs on getting your app onto Linux and Windows.

If you are building for multiple operating systems, you will run into weird issues occasionally and you’ll need to have modified build processes for each target OS. For example, this summer when I was working on an electron application we had to spend a couple days figuring out why you couldn’t launch it by double-clicking in MacOS and then a few hours figuring out why it didn’t show our custom icon in the toolbar for Linux systems.

You may have to include some logic to make it OS agnostic - normalizing file paths, for example.

When it comes to native smartphone apps, there is still more holdover of device-specific languages, but even those are becoming less of an issue.

Hardware and operating system matter if you’re writing device or OS level code. If you’re making something with a UI, there are only a few languages that are platform specific.