Re: is the C library a wrapper for windows API?



Stephen Sprunk a écrit :
"jacob navia" <jacob@xxxxxxxxxxxxxxxx> wrote in message news:44f594c5$0$27392$ba4acef3@xxxxxxxxxxxxxxxxx

As far as I remember MSDOS required to set some values in al, then
do some interrupt to talk to the hardware.

This is the case for all disk accesses and all input from the
keyboard.


You remember very, very wrong.

DOS _provided_ an API to access files, the keyboard, and the screen, but you were welcome to bypass all of that if desired and anyone writing more than "Hello World!" programs did so for performance reasons. You had to poke at hardware controllers for everything you did, and I still remember having to hook the video refresh interrupt so that writing to the screen didn't make it flicker on CGA cards.

Just about the only thing that people still relied on DOS for was file access, because the hardware was so slow that reimplementing it didn't matter -- until protected mode arrived and you had to because DOS would crater if the API wasn't called in real mode, and getting back to real mode was a monstrous pain involving manipulating the keyboard controller (a part of which is now integrated into the core for this very reason, a horrible hack) and triple-faulting the CPU.

We were speaking of the standard C library.
Accessing the keyboard directly was not so popular as you would imagine,
since made international programs fail. Maybe that's why those programs
never thrived here in France, where different keyboards (qwerty AND
azerty) were used.

As you said, the disk was always accessed with the BIOS interface.
Yes, the standard library was "slow", and many C programmers wrote
directly to the screen video, but in THEIR programs. The C library
used BIOS access.

Anyway, this is off topic here, and what is important is to remind the OP question in that thread:

Is the C library a wrapper for the windows API, and the answer is yes,
since TODAY there is no direct access to the keyboard, disk, or
video screen without a device driver.




Even in MSDOS, no program talked directly to the hardware. You are
just confused. When you call the OS with an interrupt that is still
an OS call.


See above.


The same is the case for CP/M.


DOS provided an API that matched CP/M's almost exactly because MS and IBM assumed that the vast majority of programs would be ported from CP/M. If you wanted _anything_ that performed better or did more interesting things than CP/M offered, you _had_ to talk to the hardware directly.

If everyone had used the DOS API, MS wouldn't have gone through a decade of hell trying to get DOS programs to work under Windows; they had to intercept all of those hardware accesses (for hundreds of different types of hardware) and translate them into Win16 API calls, and a lot of the Windows API today is still littered with functions that are completely illogical but map to how some piece of hardware worked 20+ years ago and is still being emulated in-kernel today.


Maybe, but the OP question was about the C library and the OS. In this
case the answer is yes, the C library resolves (eventually) into
OS calls.

.



Relevant Pages

  • Re: is the C library a wrapper for windows API?
    ... do some interrupt to talk to the hardware. ... DOS _provided_ an API to access files, the keyboard, and the screen, but ... Just about the only thing that people still relied on DOS for was file ... crater if the API wasn't called in real mode, ...
    (comp.lang.c)
  • Re: Wozu noch DOS?
    ... Hardware, von denen einer unter DOS und der andere unter Linux läuft. ... Betriebssystem dazugehören? ... oder dessen Bios in kontackt treten. ... DOS, OS2, Linux oder Windows ...
    (de.comp.os.msdos)
  • Re: Supporting a PS/2 Keyboard
    ... Why not just put the HID keyboard driver in and let ... the users use a USB keyboard, or does it _have_ to be PS/2? ... hardware or software piece putting stuff into the queue. ... interfacing directly to the PS2 connector through the supplied PB ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Hardware ansprechen
    ... Bei den ersten Rechnern war das Betriebssystem verdratet in der Hardware ... DOS system. ... Wenn du aus MSdos + Windows 3.1 ein einziges programm ...
    (microsoft.public.de.vc)
  • Re: which way is faster?
    ... So what you ask me here would be a tiny OS on top of DOS. ... alternatives to unless using hardware acceleration. ... PUSH ebx ... MOV edx,01000;scan line size ...
    (alt.lang.asm)