Thread: Something similar to WIn32 API ?

  1. #1
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020

    Something similar to WIn32 API ?

    Hi,

    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

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    47
    take a look at wxWindows or GTKmm.

  3. #3
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    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.

    thnx

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    65
    < 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.
    The experimenter who does not know what he is looking for will not understand what he finds.
    - Claude Bernard

  5. #5
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    But i'm not talking about GUI. I am talking about libraries and functions built-in Unix and Linux for programmers to use.

    thnx

  6. #6
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    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.

  7. #7
    Barjor
    Guest
    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.

  8. #8
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132


    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.

    alex

  9. #9
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    For just copying or moving a file just look at dirent.h and then read the man pages on specific directory commands.
    http://www.opengroup.org/onlinepubs/.../dirent.h.html

  10. #10
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Other file functions are found in unistd.h
    http://www.opengroup.org/onlinepubs/.../unistd.h.html

  11. #11
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    One cool command you can use is do something like
    strace mv
    Which traces the system calls that command uses.

  12. #12
    Registered User dirkduck's Avatar
    Join Date
    Aug 2001
    Posts
    428
    good info alex! thanks!

  13. #13
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Thanks, Nick.. I even benefited from that.

  14. #14
    Registered User minime6696's Avatar
    Join Date
    Aug 2001
    Posts
    267

    Exclamation WOW!

    Thats great writing! You should copy that to make a *nix/linux tutorial (intro) thing!

    SPH

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Domain for Win32 API
    By maxorator in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-28-2006, 10:16 AM
  2. Groupboxes in Win32 API
    By maxorator in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2006, 04:04 AM
  3. Textbox in Win32 API ???
    By actionbasti in forum Windows Programming
    Replies: 1
    Last Post: 11-07-2003, 02:29 AM
  4. Win32 API Questions
    By CPP-Null in forum C++ Programming
    Replies: 1
    Last Post: 05-25-2003, 04:26 PM
  5. Learn Win32 API or C++Builder?
    By Flucas in forum Windows Programming
    Replies: 1
    Last Post: 10-18-2001, 01:49 AM