Lurker News
Finally got my hobby OS up and running on real hardware. I love the old IBM thinkpads, so thought it was the perfect machine to get it working on. Been working on it for quite some time now, but this has been a big milestone!

Comments (116) 39 threads

Show all comments

Showing thread 9 of 39

badmonster1 reply#
Could you elaborate on how this compiler interacts with the operating system? Specifically, how does it handle features like structs, and what are the current limitations or planned enhancements in this area?
joexbayer#
There is no magic interaction between the compiler and OS. It simples compiles to the same machine code (i386) and uses interrupts for system calls. Structs are handled as a memory region with a size based on its members, and the member access is simply an offset into that region.

Current it has lots of limitations such as only int and char, no switch statements etc. The biggest change from default C, is allowing functions in structs and implicit passing a struct to a function if it’s a struct function. You can read more here:
https://github.com/joexbayer/C-Compiler