From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: Compiling a function to raw executable code. Date: Sat, 26 Feb 2000 10:11:55 +0200 Organization: NetVision Israel Lines: 25 Message-ID: <38B78ACB.DBE83C94@is.elta.co.il> References: <200002260336 DOT WAA05805 AT delorie DOT com> NNTP-Posting-Host: ras1-p67.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 951552772 16270 62.0.172.69 (26 Feb 2000 08:12:52 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 26 Feb 2000 08:12:52 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 Richard Poole wrote: > > Is it possible for me to use GCC to compile a function to raw machine > code and nothing else (i.e. no run-time engine, no DMPI server etc.)? You mean ``link'', not ``compile'', yes? Because compiled code doesn't include any library functions at all. Also, the programs generated by DJGPP don't include the DPMI server. > I am writing a modular audio synthesiser that opens all files ending in > a certain extension and copies their contents into allocated memory. > These files (otherwise known as devices) should contain raw executable > code, and I need the main program to be able to call that code. In the > main program there is an array of pointers to the devices that it has > loaded into memory, like this... If you need ``raw code'', you could simply read only the .text section of the program. It's easy to do that: the COFF header includes a pointer to that section and its size, so it's just a bit of simple code. There are places in the DJGPP sources you could look that up, if you want. But I think that you need something else: you need an ability to dynamically load code fragments at run time. For that, you could try DXE or DLX. See the DJGPP FAQ for details and pointers to the resources on the net.