Um..., noob Question...

Programming, for all ages and all languages.
Post Reply
Buck1000
Posts: 16
Joined: Wed Aug 29, 2007 2:12 pm
Location: Seatac, WA

Um..., noob Question...

Post by Buck1000 »

So how do you get a C++ program into a .bin file? I've managed to compile it into a .obj format, but now I really don't know what to do. The reason why I ask, is I got a bootloader that loads a .bin file off a floppy, and I wanna write my OS in C++, so how do I turn my OS into something a bootloader can recognize?
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Post by JackScott »

Hmm... For this you'll need a linker, such as LD (the GNU linker) which is very good. That will take any number of *.o or *.obj files, as well as libraries (*.a) and turn them into executables. LD is capable of generating flat binary files, which is the *.bin format you're talking about.

Also remember that if you are using flat binary, you will probably (you might not, but probably) need an assembly stub before you can go into C/C++ code. See the wiki page Bare bones for an idea on how to do it. It is targetted for ELF, but it should be fairly easy to turn into into a flat binary kernel.

Hope this helps.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Buck1000: please see my post in your topic entitled "How do I get started?"
Post Reply