Making OS in VS 2005 (pro)

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
Speewave
Member
Member
Posts: 40
Joined: Fri Jun 22, 2007 1:11 pm
Location: The USA
Contact:

Making OS in VS 2005 (pro)

Post by Speewave »

i have both Visual Studio 2005 Professional Edition with C++ and Cygwin. i heard you can make a OS in Visual Studio... Is it Possible?
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

I would not suggest using VC++ to compile your kernel/os
I use VC++ as my IDE, but I use a cygwin cross compiler to actually compile it.

Good luck,

--Michael
Speewave
Member
Member
Posts: 40
Joined: Fri Jun 22, 2007 1:11 pm
Location: The USA
Contact:

Post by Speewave »

thanks... Visual Studio does have a good debugger! but can i still use things like iostream or something like that?
Crazed123
Member
Member
Posts: 248
Joined: Thu Oct 21, 2004 11:00 pm

Post by Crazed123 »

No, not at all. An OS has no software sitting under it providing it with neat little APIs.
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Exactly. There is an article in the wiki about configuring VC++ for compiling, so you might want to give it a try. (not for the weak of heart)

--Michael
User avatar
dc0d32
Member
Member
Posts: 69
Joined: Thu Jun 09, 2005 11:00 pm
Location: Right here

Post by dc0d32 »

what benefits (apart from a great IDE) do you get when using VS2005? No debugger (unless you write a windbg stub for your kernel), no EH (and if you try to support it, you sacrifise FS register), less control over compiler (as comparef to gcc).

The trick in the wiki really cheats (so does msvceok) and isnt a very elegant of solution.

The solution (as suggested by many) - use VS as an IDE, compile using gcc.

I once tried writing test kernel in VS2005 C++, it was a basic kernel-success! But trust me - gcc makes life much more easier.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

@Any moderator:
This thread belongs in OS Development.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Yeah. I really can't suggest it either. Go with Cygwin. (Or Mingw. Did they ever fix that bug? I haven't used it in ages...)

As for the debugger, I believe several emulators come with one built in. (GDB, I think.)

That's about it. You could even try a different editor if you like. (Vi is nice.)

That's about it. ;)
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

The trick in the wiki really cheats (so does msvceok) and isnt a very elegant of solution.
No, msvceok does not cheat. At the very least I had been arguing that it was a very elegant way. It uses a stub inserted by the linker which loads the PE32 correctly into memory.

I wrote that. I remember, before any other had. By the way does anyone have the most recent version of that I wrote? I lost it a while back. Found it for a guy and uploaded to the old forum.. then during the transition here it got lost again (the post attachment)... sadly..

The trick in the wiki really cheats..
You are right about this. I kept telling people it would not work forever. They just would not listen. I am glad someone else finally views that ""trick in the wiki"" the same as I did.
LaurensR1983
Posts: 24
Joined: Wed Jun 27, 2007 10:34 am

Post by LaurensR1983 »

I'm using a combination of the microsoft c compiler with the GNU linker and NASM.

I did this by creating a makefile project in VS2005 and creating a batchfile wich calls cl.exe (the MS C compiler). I used the GNU linker because it offers some flexibility that the microsoft linker doesn't have (or that I'm not aware of).. in my case linker scripts :)

I suggest you learn some information about Multiboot compatible PE kernels to start out with. I don't reccommend doing a non multiboot compatible PE kernel, because you would need a custom bootloader which is able to load PE images.

It's not possible to use VS2005 debugging, because:

- You would be running in a virtual enviroment (either Bochs, Virtual PC, VmWare etc)

- VS2005 uses a background service (called MDM) for debugging windows applications. Which you clearly don't have in your OS.

So if you want good debugging tools, I suggest you use BOCHS (helped me out a lot of times).
Post Reply