View Full Version : Something similar to WIn32 API ?

01-27-2002, 10:04 PM

I know that windows has a set of functions called api for programmers to use to do tasks such as copying or movign a file. Does Linux has some similar set of functions too? WHat about Unix?

thnx in advance

01-27-2002, 11:36 PM
take a look at wxWindows or GTKmm.

01-27-2002, 11:58 PM
But is there a kind of like a built-in library or API in Linux or Unix for programmers to use? Coz the ones you suggested are third-party ones.


01-28-2002, 12:57 AM
< third party ones.

Nearly all of the components of Linux are third party ones. So as long as you write for KDE or GNOME, you don't need to worry about it.

01-28-2002, 01:32 AM
But i'm not talking about GUI. I am talking about libraries and functions built-in Unix and Linux for programmers to use.


01-28-2002, 11:22 AM
The standard C/C++ libraries. That's what you get built in.

The libraries that are similar to Win32 are the xlib, Motif, GTK, QT, etc. Probaly closest to GTK and QT or any of the other high level APIs.

01-28-2002, 01:03 PM
In a way it sems like Linux(kde and gnome) is kinda built like the old win3.1 and win9X (putting on my asbestos suit) with a command prompt program that have a gui runing on top of it. I am not saying linux isn't better then any of the old win OS's but the principel sems to be the same. I think the interface for the KDE gui stuff is called xwindows, never programed Linux so I don't know more then that.

01-30-2002, 04:16 PM

Barjor: you're quite right that the gui is running on top of the command line program (although it's a bit more subtle than that). The big difference is that this command line program is a real 32-bit process, not a 16-bit program that uses only the low 1Mb of your memory. In fact, both linux and windows have more layers...

kernel: this is "linux", (about 1Mb big) it's the core of the OS (for dos: IO.SYS and MSDOS.SYS).

init: the first process the kernel starts, which checks the filesystems ("scandisk"), loads modules for the kernel, and initializes daemons ("services") and things like network connections. (CONFIG.SYS, AUTOEXEC.BAT, SYSTEM.INI and some parts of the registry file)

All network services are available at this point. What is the point of running a gui on a http/ftp/mail server? If you have no gui installed you will get a text-mode login prompt, and if you login you'll get a shell:

bash: the default shell for linux... (i.e. COMMAND.COM) Needless to say that it is very powerful. Maybe a bit of a steep learning curve to get that power unleashed, but easy to learn for people that need just a few of the standard commands.

Then things get crazy for windows: it starts its 32-bit gui. Switching back to 16-bit mode for each interrupt of each device is very slow, so 32-bit device drivers take over from the 16 bit ones. The original 16-bit drivers cannot coexist with 32-bit drivers, so the original command.com has to disappear. (For DOS prompts opened within windows, windows creates fake 16-bit interrupts to communicate with the devices via the 32-bit drivers)

xinit (X): The graphical layer for linux consists of a server and client part. The graphical part (the server) can run on an other machine than the client! The client has no graphics capabilities, but it communicates with X programs and one or more X servers. An X program tells the X client to draw something somewhere, and the X client forwards these requests (possibly in an optimized way) to the X server. Keyboard and mouse input is sent from the server via the client to the program.

The gui is separate from X, and usuallu called window managers. There are many window managers for X. The most popular one seems to be KDE, but there are many others: xfce, wmaker, wm2, w9wm, vtwm, twm, sawfish, sapphire, ratpoison, qvwm, pwm, oroborus, olwm, lwm, larswm, icewm, gwm, fvwm95, fvwm, flwm, enlightenment, ctwm, blackbox, asclassic, afterstep, aewm, 9wm, olvwm.

I have to say that kde is a very good window manager for beginning linux-users, because it has many good interfaces to change the setup of the system using gui-applications. Not many people I know use kde though... I prefer afterstep, although you can only configure it by editing textfiles by hand. Windowmaker (wmaker) has about the same interface, but it has additionally a graphical configuration tool.


02-02-2002, 11:25 PM
For just copying or moving a file just look at dirent.h and then read the man pages on specific directory commands.

02-02-2002, 11:27 PM
Other file functions are found in unistd.h

02-02-2002, 11:31 PM
One cool command you can use is do something like
strace mv
Which traces the system calls that command uses.

02-11-2002, 02:01 AM
good info alex! thanks!

02-11-2002, 04:15 PM
Thanks, Nick.. I even benefited from that.

02-12-2002, 05:33 PM
Thats great writing! You should copy that to make a *nix/linux tutorial (intro) thing!

SPH :rolleyes: :confused: :rolleyes: