Page 1 of 1
flat binary
Posted: Sun Nov 24, 2002 8:50 am
by engine252
i use the djgpp compiler just a while but how can i make
the compiler compile to a flat binary file? ???
Re:flat binary
Posted: Sun Nov 24, 2002 10:10 am
by PlayOS
Just compile your file, then use objcopy to strip the header(s).
Like this:
gcc -c file.c -o file.o
objcopy -O binary file.o file.bin
That -O is O for October not Zero.
You must also make sure that you file does not rely on any external variables or functions, or otherwise the flat binary file will not work.
Hope this helps.
Re:flat binary
Posted: Mon Nov 25, 2002 7:03 am
by Tim
You must also make sure that you file does not rely on any external variables or functions, or otherwise the flat binary file will not work.
That's because you forgot to link it.
gcc -c file1.c -o file1.o
gcc -c file2.c -o file2.o
ld -o file.out file1.o file2.o
objcopy -O binary file.out file.bin
Re:flat binary
Posted: Mon Nov 25, 2002 8:32 am
by PlayOS

::)
Re:flat binary
Posted: Mon Nov 25, 2002 8:56 am
by engine252
isn't there a good ide out there that take care of all that linking and stuff???
Re:flat binary
Posted: Mon Nov 25, 2002 11:53 am
by Tim
Sure, plenty. Visual Studio is my favourite.
Re:flat binary
Posted: Mon Nov 25, 2002 1:44 pm
by Tom
I will be making a IDE...and someone else here will....I think it is "M@rtin12345"
Re:flat binary
Posted: Mon Nov 25, 2002 1:45 pm
by engine252
can visual studio outpu binary files and is it possibel to create a OS system dispite the fact you may only create windows software with it.
Re:flat binary
Posted: Mon Nov 25, 2002 2:27 pm
by Tom
Nope....only win32 bins...but the ide can make the files you type up.
Re:flat binary
Posted: Mon Nov 25, 2002 3:14 pm
by engine252
if somebody made a good ide for djgpp please let me know if you make the ide please make sure there is good support for outputting binary files ;D
Re:flat binary
Posted: Mon Nov 25, 2002 3:19 pm
by Tom
I'm working on it now...but first...I need to download DGJPP
Re:flat binary
Posted: Mon Nov 25, 2002 3:31 pm
by whyme_t
Textpad is a good win32 ide

You can add programs to run as commands with keyboard shortcuts. So ctrl+1 could run nasm, ctrl+2 could run gcc, ctrl+3 could run ld. etc. Add you can use $File and $FileDir as parameters to the programs.
You can also view hex files, dos, ansi, unix, etc, etc.
www.textpad.com
Re:flat binary
Posted: Mon Nov 25, 2002 10:56 pm
by Schol-R-LEA
engine252 wrote:
isn't there a good ide out there that take care of all that linking and stuff???
The Emacs C and C++ modes have a preset compile command that runs "make -k" by default. You'd still have to write a Makefile, but given the kinds of things that can be done automatically by [tt]make[/tt](1), this is a Good Thing. You can go far beyond just compiling with a single step that way.
Re:flat binary
Posted: Tue Nov 26, 2002 6:11 am
by Tim
Tom wrote:Nope....only win32 bins...but the ide can make the files you type up.
No, the linker emits Portable Executable files, which Windows happens to use, as do ReactOS, Mobius, and various loaders. My point is: VC++ isn't tied to Windows.