Any substitution for compiler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Magmadragoon

Any substitution for compiler

Post by Magmadragoon »

When making an OS can you use different compilers instead of NASM and DJGPP?

Do you know any compilers and assemblers that I can use that work with Windows XP?

Can you use MS Visual C++ to make a kernel?
JFF

Re:Any substitution for compiler

Post by JFF »

NASM and DJGPP will work in Windows XP... i used them on windows 2000 and windows XP with no problem. All you have to do is to setup environment variables if I remember (or go the lazy way and find an installer somewhere on the web, can't help with that one :P i don't have it). But i installed cygwin and was used that for a while... Now I'm only using linux with the really good combinason [make + gcc + nasm + ld]. And I think the environnement you set up to work should be the one that you feel the more comfortable with.

And for the compiler in Visual C++... i'm not sure... but I don't think this compiler can generate files that can be loaded as an OS. But I've seen some project using it as an editor. I also think that you can change some settings to get it working with other compilers but you won't be able to debug as easy as if you were using their compiler since MS VC++ doesn't support the error/warning output.
Schol-R-LEA

Re:Any substitution for compiler

Post by Schol-R-LEA »

Underlying this question are two others: "Which compilers or assemblers produce the type of object file I want to use?" and "Can I disable or remove any OS-specific code which the compiler would normally insert into the object file?" To these, I would also add the question, "Can the compiler be ported to my OS at a later time?" This puts specific limits on which compilers you can use, but it also gives a fixed criteria by which you could determine what compilers are suitable from their own documentation.

Note that these rules apply to languages other than C, as well, though the rule concerning no OS dependent code becomes more important. Most languages require considerably more runtime support than C does, and unless the particular language and implementation was written with low-level systems programming in mind, chances are the compiler generates at least some OS-dependent code.

Visual C++ 6 normally produces PE files; I don't know offhand if it will generate raw binaries. It does not support any other formats, AFAIK. I do not know if it can build system-independent code, either. It certainly isn't going to be portable to your OS unless you write a Windows emulator...

Visual C++.NET is a rather different beast, and I do not know much about it, but AFAICT it generates MSIL like the other .NET compilers, at least by default. Any corrections or clarifications on this would be appreciated.

Any flavor of GCC (of which DJGPP is but one) should be suitable, as it can be retargetted for a variety of platforms and formats. However, you may have to use a specific build of it in order to get the output type you want; see the GCC Cross Compiling page in the OS Dev FAQ for details.
Post Reply