Is There a Core Linux API Analogous to Windows Winapi, in Particular for Creating Gui Applications

Is there a Core Linux API analogous to Windows WINAPI, in particular for creating GUI applications?

I think you're looking for something that doesn't exactly exist. Unlike the Win32 API, there is no "Linux API" for doing GUI applications. The closest you can get is the X protocol itself, which is a pretty low level way of doing GUI (it's much more detailed and archaic than Win32 GDI, for example). This is why there exist wrappers such as GTK and Qt that hide the details of the X protocol.

The X protocol is available to C programs using XLib.

What would be the equivalent of Win32 API in linux?

You need to understand what syscalls are. On Linux, they are the lowest possible user land API (in contrast Win32 API probably mixes real kernel syscalls with some libraries functions. libc also does such mix on Linux). fork(2), execve(2), open(2), pipe(2), mmap(2), read(2), poll(2), close(2), dup2(2), sigaction(2) are important syscalls (but there are about 300 of them, see syscalls(2) for a list, which depends upon your precise Linux kernel).

Don't expect each Windows functionality to be available on Linux (and vice versa).

Don't even think of such an equivalent.

Get a different mindset on Linux.

(In particular, processes are very different on Linux and on Windows).

Don't forget that Linux is free software, and you can dive into the source code of every function you are using on Linux. Read it, search it, improve it.....

Read the intro(2) man page first, and several other man pages (notably syscalls(2), intro(3) etc...). Read also e.g. Advanced Linux Programming and Advanced Unix Programming.

Some libraries try to factor out and provide a common abstraction for both Posix (e.g. Linux) and Windows. In particular Qt (and also Gtk or FLTK or POCO, and Wt for web applications, and sqlite for databases).

Some open source server software (e.g. lighttpd, exim, postgresql, etc...) can run on both Linux and Windows (of course, after recompilation)

If you are interested about graphical interface, understand the important role of X11 (notice that the X11 server is nearest to screen & keyboard; most graphical applications are X11 clients). In 2016 or 2020, X11 tend to be superseded by Wayland (but you won't notice that implementation "detail" - a really major one - if you code against Qt or GTK)

If you write an application using only Qt and/or POCO calls (those not documented as being specific to Linux or Windows) in addition of standard C++ functions, it should be source portable from Linux to Windows and vice versa.

Modern, native way of creating WinAPI GUI apps in C++

I recently used Qt4 and was very pleased with the API. I found it straightforward, well documented, and the code is extremely concise.

Qt does an extremely good job of emulating the target OS look and feel (as @In silico pointed out in the comments, Qt actually draws everything itself and does not use native components) Regardless, this can be coded by hand or visually through the GUI editor in their IDE, Qt Creator. If you go this route, I recommend creating your initial GUI project (.pro file) there, then importing it into Visual Studio via the Qt Visual Studio Add-In.

Slots and signals, Qt's event/messaging system, is also worth mentioning. Yes, it's critical to GUI programming, but could also be extremely useful in lower-level code.

I expect Qt would work well in your project, but as always, create a few simple tests to ensure the technologies will work together feasibly.

gui development toolkit for linux and windows

For cross-platform programming you might want to look into JVM based languages (most notably Java, but Scala, Groovy etc. might be fine) which provide the Swing gui framework.

Additionally there are other platform independent languages like Python etc.

As for C++ there GUI toolkits like Qt or GTK+.

Create a small 'window-form' application that runs anywhere

I have both worked with PyQt and wxPython extensively.
PyQt is better designed and comes with very good UI designer so that you can quickly assemble your UI

wxPython has a very good demo and it can do pretty much anything which PyQT can do, I would anyday prefer PyQt but it may bot be free for commercial purpose but wxPython is free and is decent cross platform library.

Experienced Windows programmer wants to learn Linux programming

To get used to a linux environement, I think you should first get a live CD/USB of any Linux distribution that you want. By example you can follow this tutorial for Ubuntu or this one for Fedora.

Then, you can open a terminal and follow another tutorial like this one, to start programming on Linux.

Finally, if you need to install the Linux distribution, you should know that nowadays every good Linux distribution have a very easy installer directly available from their live CD/USB. Just put your basic configuration and click next !



Related Topics



Leave a reply



Submit