开发者

Is there any Linux API, like windows get windows API, Mac get Cocoa? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question 开发者_如何学运维

I know that the Windows platform have windows API from Microsoft, and Mac get the Cocoa API from Apple. I want to know it there any API from the Linux Community? thx a lot.


Since your question is extremely general, I'll assume you're referring to the Linux Kernel API.

Each OS gives you some API to do low-level operations, otherwise it wouldn't be much of an operating system, now would it?


There are many API options, these are the APIs that first come to my mind, in a sloppy "closer to hardware and more likely to be installed" to "further from the hardware less likely to be installed" order, unless otherwise noted:

There is the Linux system call API, as documented in /usr/include/syscall.h or /usr/include/sys/syscall.h which is 100% guaranteed to be there if your kernel is Linux.

There is the Linux console programming API, which controls character display for programs meant to run in the Linux console (not a terminal window, but in the raw console before X11 starts up).

There are the posix system calls, which will be available on pretty much every Linux that is not an embedded system.

There is glibc, which is less commonly available than the posix API, but generally present.

There is the Linux framebuffer API which allows graphic programming on a raw level without running a windowing system.

There is the ncurses API, for character / terminal control, that will work in the Linux console, or an xterm, or from a terminal emulator accessing the system via ssh.

There is Fresco (once known as Berlin), which is an API for graphic programming without the historical baggage of X11. It is pretty rarely used on the Desktop and doesn't have very many apps that run in that environment.

There is the X11 API, for programs meant to run under the standard X11 graphic interface. X11 has a huge number of wrapper libraries, because it is extremely complicated, and extremely flexible, and very tedious for programming in directly. For example IIRC X11 does not define any sorts of widgets (ie. text boxes, buttons, menus, scroll bars, etc.) these need to be implemented by your own code.

There is xlib/athena, which is basically just a set of libraries implementing simple ugly widgets, and it is the original wrapper API for making X11 programming easier.

There is Motif, the proprietary successor to xlib, and Lesstif, the open source emulation of Motif.

There is TK, which started out as a library for the Tcl language, but has bindings for perl, python, R, and many other general purpose / utility scripting languages, and is cross platform, very easy to use for programmers, and quite ugly and archaic (ie. early '90s era widget design, no support for scroll wheels or drag and drop).

GNUStep, and objectiveC environment for *nix including Linux, which is an X11 wrapper GUI toolkit and general programming API derived from the same nextStep system that Cocoa is.

There are QT and GTK, which are the most commonly used X11 wrapper Graphic toolkit APIs these days. Qt is also a cross platform library which tries to integrate well with other platforms and embedded displays for example on cell phones.

There are Gnome and KDE, which are built on top of GTK and QT respectively, and have a larger amount of Desktop integration, usability, and ram and CPU usage than pretty much any of the other alternatives - in particular people who try to use Gnome and KDE apps simultaneously will have a significant amount of redundant libraries doing the same things in incompatible ways (in ways that often do not integrate between the two Desktops) loaded into RAM.

There is WxWidgets, which is meant for cross platform applications. It uses GTK on Linux and the native toolkits on Mac and Windows.

In summary: just like everything else, Linux has a bewildering array of choices for APIs (the bewildering array of APIs is pretty much the source of the bewildering array of looks and feels in Linux applications).


It is difficult to answer because the Windows API and Cocoa do not have the same role.

Linux is a kernel for Linux based systems. As is darwin for Mac OS X and the Windows, or NT kernel for windows. In each of these systems you can write applications focused on interacting with the end user, with graphics, windows and such, or focused on interacting with the kernel, to do things such as networking, controlling storage.

When you think of a Cocoa application, I believe you generally think of user focused, graphical applications, while the term Windows API mainly refers to low level operations. In the Windows world, the equivalent to Cocoa is not the Windows API are the various COM, COM+, DCOM and now the .NET framework with things such as WPF.

If you want to write graphical applications which work on Linux similar to those in a default Ubuntu install, take a look at GTK. If you want to write sytem level programs, you'd probably need first to research Unix programming in general. A classical book is 'Advanced programming in the Unix environment' by Richard W. Stevens.


No, unlike vendor-controlled platforms like Windows and OS X, Linux distributions have no single-source proprietary Linux-only API that is the universal standard default for everything from low-level file access right up to GUI interfaces.

The closest equivalents are things like Qt, but that's a cross-platform API, not something Linux-specific.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜