API Communication

268 views

I know how Web-APIs work, but how do APIs between two apps on one system work fundamentally?
If I write program A, that exposes an API X, and an Application B that calls on that API, how does that work from a compiler, OS and hardware standpoint?

In: 5

9 Answers

Anonymous 0 Comments

API is a broad term that just means some way for one program to communicate with some other program via an explicit, intentional interface. It doesn’t refer to one specific technology.

Here are a few examples.

The operating system exposes APIs for programs to call. That’s how a Windows program opens up an application window or installs itself in the system tray, for example, or how a macOS program displays things in the global menu bar. The details are very operating-system-specific, but essentially all the programmer needs to do is call a function, and that function call jumps to the operating system to execute it.

Another way is to link software libraries, like a DLL. That’s basically code that the application can call as functions directly.

However, you asked more about two apps on the same system.

In that case, they could use operating system pipes, they could use network ports (like HTTP), they could use shared memory, or they could use another operating system-specific system like COM on Windows or dbus on Linux. So many options!

You are viewing 1 out of 9 answers, click here to view all answers.