Thread: Need Help..

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72

    Need Help..

    Actually I have two Questions

    Q.1: How to write a C language code which is completely machine dependent (means which can run even without OS) ????

    Q.2: Is there any open source C compiler exist which can be added in any OS code (in asm) ????
    IF NO
    Q.3: How can we add a C compiler in a Simple OS code ????
    There is a Real magic in enthusiasm, It spells the difference between mediocrity and accomplishments.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    EDIT: Sorry, misunderstood your questions

    1) What you want is raw binary, without rellocation tables and sections.

    2) Of course there is, GCC for instance.

    3) You can in one way or another.
    Last edited by GReaper; 10-28-2011 at 01:23 PM.
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72
    Quote Originally Posted by GReaper View Post
    EDIT: Sorry, misunderstood your questions

    1) What you want is raw binary, without rellocation tables and sections.
    I want to know.. how to obtain this type of code ??

    2) Of course there is, GCC for instance.
    I believe GCC is for Linux.. Right ???

    3) You can in one way or another.
    Can you tell me any one way atleast....
    There is a Real magic in enthusiasm, It spells the difference between mediocrity and accomplishments.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by Gaurav Singh View Post
    I want to know.. how to obtain this type of code ??
    Read the documentation of your compiler, there must be instruction for producing something other than an executable.

    Quote Originally Posted by Gaurav Singh View Post
    I believe GCC is for Linux.. Right ???
    It was firstly built for it, so what? It's code can be portable.

    Quote Originally Posted by Gaurav Singh View Post
    Can you tell me any one way atleast....
    You at least need a basic kernel before porting a compiler into your OS. Therefore "Simple OS code" wouldn't be enough...
    Devoted my life to programming...

  5. #5
    Registered User
    Join Date
    Dec 2010
    Location
    Lucknow, India
    Posts
    72
    Quote Originally Posted by GReaper View Post
    You at least need a basic kernel before porting a compiler into your OS. Therefore "Simple OS code" wouldn't be enough...
    buddy.. I already write my own Kernel code.. which contains "a text editor+keyboard hadling+file mangement"... no GUI in it.... Now I want to add a C compiler in it so that I can write more applicatins for it.. So Can you tell me how to add a C Compiler in it..???
    There is a Real magic in enthusiasm, It spells the difference between mediocrity and accomplishments.

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    You will either need to write your own compiler or port an open source compiler, such as gcc, to your kernel. A compiler is operating system specific, so you can not just "get" a compiler for your operating system, one must be created. This page has a listing of several compilers that you may be able to customize for your operating system.

    Jim

Popular pages Recent additions subscribe to a feed