From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: Compile in raw binary Date: Fri, 07 Apr 2000 17:30:33 +0200 Organization: NetVision Israel Lines: 31 Message-ID: <38EDFF19.E81A2138@is.elta.co.il> References: <8ck4q5$oob$1 AT mail DOT pl DOT unisys DOT com> NNTP-Posting-Host: ras1-p49.rvt.netvision.net.il Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.netvision.net.il 955121349 5005 62.0.172.51 (7 Apr 2000 15:29:09 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 7 Apr 2000 15:29:09 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,ru,hebrew To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Aquaz wrote: > > Hi all! > I'm a c/c++ developer but new about djgpp compiler. > Is it possible compile a simple c code into raw binary x86 opcodes, similar > the .COM file? Not really. > int main(void) { > register x; > x = 0; > ... > return(0); > } > > Can i build it to have a file like: > B8 00 00 ... CB > (that would be "mov ax, 0 ... retf" ) You could compile the source ("gcc -c foo.c"), then convert the object file to the raw binary format, like this: objcopy --output-target=binary foo.o foo.bin The file foo.bin will include only the opcodes produced by the compiler from the C code. Note that the code produced by the compiler from the above source is VERY different from what you think. Anyway, you really should explain what do you need this for, because that would allow to give you more accurate advice.