-1

Context:

Creating a toy OS, written in assembly and C.

X86. 32-bits first, 64-bits then.

Currently read how to make a C library and try to understand the underlyings.

My question comes from the reading on this page.

I read the other SO questions concerning runtime libraries but still don't get it.


Question:

Ok, a runtime library seems to help providing low level functionalities that an application library cannot provide.

What wonders can I do with a runtime library ?

My searches on the subject lead to theoretical explanations (MSDN and so on).

I need a practical, visual explanation.


Update:

I saw the question the admins refer to, and I obviously read it already. But it was not enough high level. But that is fine :) Thanks

Community
  • 1
  • 1
Larry
  • 1,735
  • 1
  • 18
  • 46
  • @RyanJ: yes, I learn by doing something too difficult; that is the point ! Could you elaborate please ? – Larry Mar 09 '15 at 16:35
  • I guess you are on your way here: http://stackoverflow.com/questions/2766233/what-is-the-c-runtime-library – Eugene Sh. Mar 09 '15 at 16:38
  • @Larry By doing something "too difficult" you are missing the basics (and yes, you are). – Eugene Sh. Mar 09 '15 at 16:42
  • @EugeneSh. : Why being so rude ? I don't undestand why on this site so many people react like that. I strongly disagree that something too difficult leads you to the next wall. This point neglect one's intelligence. That is despising. And not encouraging. But that is another story. So a runtime library is a library which enable the application libraries to work correctly, providing the right way to do the low level things so that application can think about the problem to solve (malloc, conversions..). right ? – Larry Mar 09 '15 at 16:47
  • 1
    A C runtime library is more a part of your C implementation than it is a core part of the operating system, especially if the C implementation provides only static linking, as might be the case in a toy OS. Among other things, though, the C runtime library provides all the functions necessary for programs to obtain services from the OS, such as memory allocation and I/O. – John Bollinger Mar 09 '15 at 16:48
  • 1
    @Larry It's not rude, its an advice. Judging by your questions here you are going from wall to wall. Even the most experienced experts are starting from basics when encountering something new. Working with new microcontroller an embedded developer will start with blinking LED, a programmer will start with "Hello, world" when learning new language, no matter how much "Guru" is him. – Eugene Sh. Mar 09 '15 at 16:50
  • @EugeneSh.: Fine, you noticed that I am progressing then. – Larry Mar 09 '15 at 16:52
  • @JohnBollinger: Thanks john, you gave me the visual I was waiting. Would please be kind enough to make it an answer ? +1 by the way. – Larry Mar 09 '15 at 17:46
  • If you need "_practical, visual explanation_" then **study source code** of the several available open source `C` runtime libraries and you'll see what they are good for – xmojmr Mar 10 '15 at 08:41
  • @xmojmr: you are right. This is what I usually do, but this time I needed something else I fear. But you are definitely right. ;) – Larry Mar 10 '15 at 08:46

1 Answers1

0

A C runtime library is more a part of your C implementation than it is a core part of the operating system, especially if the C implementation provides only static linking, as might be the case in a toy OS.

Among other things, though, the C runtime library provides all the functions necessary for programs to obtain services from the OS, such as memory allocation and I/O. These are not necessarily the same functions the OS kernel uses internally for the same or similar purposes.

Programs written in other languages may or may not rely on the C language runtime (they may provide their own, independent one instead), and statically-linked C programs include all necessary functions in their own images, instead of relying on dynamically loading them from a library at run time. In a sense, the C runtime library is distributed and duplicated across all statically-linked programs built from C sources.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157