Page 1 of 1

C Kernel, and the Runtime Library

Posted: Mon Feb 14, 2011 10:43 pm
by mark3094
Hi,

I have written a simple bootloader in assembly, and now I want to begin writing a Kernel in C.

So far I have setup Visual C++ Express according to the guide at: http://www.brokenthorn.com/Resources/OSDevMSVC.html
I have created a simple ASM entry point that sets the stack location (as recommended here: http://www.osdever.net/tutorials/view/s ... ng-your-os) and passes control to a procedure written in C that simply writes a few characters to the screen as a test. All this works well so far.

I am getting a little confused when it comes to understanding how the runtime library works in this case. The first link above refers to creating a runtime environment for VC++, but it looks like they're referring to C++ not C (I don't know any C++ so I'm not sure).

Do I have to create a C runtime environment for my Kernel? Are there any resources which state exactly what the C runtime does? As far as I understand, the C runtime provides a starting environment for the Kernel, which I have partly done by setting up the stack and other registers in my entry routine. What else does it need to do?


Thankyou very much for your advice

Re: C Kernel, and the Runtime Library

Posted: Mon Feb 14, 2011 11:12 pm
by thepowersgang
There is no need for a runtime library to use C, you can (and must, when doing kernel dev) do it all yourself.

C++ needs runtime libs for some of the more complex features (exception handling for one)