Thread: How do they compile code for an OS ?

  1. #46
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > I think it involves calling the main function.

    What main function? At the bit level, there's no main function.

  2. #47
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    >And what is the name of that program on a windows machine? I would love to look it up...<

    What exactly do you mean by "name"? Filename? Internal application name?

    >And so what really does it mean to "run" the program? That is, there must be a program that the OS runs to "run" executables-how does it work<

    The OS transfers control of the PC to the program. For how long? Depending on how the tasking model of the OS is set up. Maybe a few milliseconds, or perhaps even until the program finishes executing.

    >Right now I am working on the parse-end of a compiler.<

    Interesting. Good luck!

    >I think it involves calling the main function.<

    Generally speaking, it actually calls a function named _start() which in turn calls main(). Of course, like shtarker said, this is a broad description of what happens.

    >What main function? At the bit level, there's no main function.<

    Govt, you're a C/C++ coder right? I'm sure you're familar with pointers then. As you should know, a pointer is simply a variable that holds a memory address. Function names in C/C++ are similar - they are an identifier for a section of code. main() doesn't get called (because as you said in the bit level, there is no main), but the code that was previously known as main() does (with a jmp instruction).
    Last edited by Hillbillie; 03-27-2002 at 03:57 PM.

  3. #48
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Shiro, did u mean a compiler can't compile itself? Then how'd u compile a compiler so that compiler can compile other programs?

  4. #49
    Registered User
    Join Date
    Jan 2002
    Posts
    363
    >>Shiro, did u mean a compiler can't compile itself? Then how'd u compile a compiler so that compiler can compile other programs?

    ummm. . . . .with a compiler?

  5. #50
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    um..............okok

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code won't compile
    By monkles in forum C Programming
    Replies: 3
    Last Post: 05-28-2009, 01:45 PM
  2. Compile Errors in my Code. Can anyone help?
    By DGLaurynP in forum C Programming
    Replies: 1
    Last Post: 10-06-2008, 09:36 AM
  3. Cross (compiler | OS) && reuseable code
    By audinue in forum C Programming
    Replies: 6
    Last Post: 07-22-2008, 12:46 PM
  4. How Can I compile 3 source code in 1 program ?
    By lord_cedrich in forum C Programming
    Replies: 8
    Last Post: 12-10-2006, 05:10 AM
  5. ....this code doesn't compile, very odd error
    By Leeman_s in forum Windows Programming
    Replies: 2
    Last Post: 11-03-2002, 02:31 PM