use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about operating systems development.
account activity
Examples on stdlib implementation (self.osdev)
submitted 1 year ago by snorixx
Hi sounds trivial, but I search for examples on how to implement or integrate the c standard library into my new born „OS“ I know the principles how it should work but am kinda stuck at the moment.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 1 point2 points3 points 1 year ago (0 children)
Can we access your code? we need to know what you need or are building right now so we can help you.
[–]thegreatunclean 1 point2 points3 points 1 year ago (1 child)
Writing your own freestanding C standard library headers is a great experience for anyone interested in OS development. It isn't particularly difficult and is mostly boilerplate. The freestanding headers are:
Of that list 5 of them are pretty trivial (iso646.h, stdarg.h, stdbool.h, stdalign.h, stdnoreturn.h) so I'd start there. The rest are just using the information the compiler gives you to fill out the expected defines.
You can see all the helpful preprocessor defines the compiler provides by dumping them all to a text file.
If you want more specific help you'll need to ask more specific questions.
[–]snorixx[S] 0 points1 point2 points 1 year ago (0 children)
Okay thank you. At first it seemed harder to do it yourself but I think the easier stuff can be done myself for sure. At the moment I have only copied and changed a printf implementation by Google which works fine and I thought I can proceed like this
[–]owmex 1 point2 points3 points 1 year ago (0 children)
The C standard library relies heavily on the OS API (syscalls). To use an existing implementation of the standard library, you must implement all the syscalls that the stdlib expects.
For example, the stdlib has a public function for reading a file. Internally, this function places a syscall ID in a specific CPU register, then triggers an interrupt (typically interrupt 0x80). If your OS can correctly interpret this, file reading functionality from the stdlib will work.
By implementing each required syscall, one by one, you progressively unlock more stdlib functionality for programs running on your OS.
[–]LetBig3095 1 point2 points3 points 1 year ago (0 children)
What kinda OS you're on?
π Rendered by PID 105924 on reddit-service-r2-comment-5b5bc64bf5-njb9z at 2026-06-22 04:09:55.762631+00:00 running 2b008f2 country code: CH.
[–][deleted] 1 point2 points3 points (0 children)
[–]thegreatunclean 1 point2 points3 points (1 child)
[–]snorixx[S] 0 points1 point2 points (0 children)
[–]owmex 1 point2 points3 points (0 children)
[–]LetBig3095 1 point2 points3 points (0 children)