From: camorgan AT amoco DOT com Message-Id: <199612042150.AA17922@interlock.amoco.com> Date: Wed, 4 Dec 96 15:19:29 -0600 Subject: DJGPP standalone executable question Mime-Version: 1.0 To: djgpp AT delorie DOT com Content-Type: text/plain; charset=US-ASCII; name="cc:Mail" Content-Transfer-Encoding: 7bit Content-Length: 3247 Hi! I have the DJGPP C compiler and like it very much. However, I am trying to compile a standalone executable in DOS 6.21 for someone else who does not have the DPMI server. From the FAQ documentation, it appears there is a way to do this. I refer to the following FAQ section: ------------------------------------------------------------------------ 4.5 What Files to Download? =========================== ... `v2misc/pmode11b.zip' This is an alternative DPMI server, PMODE/DJ. Its memory footprint is smaller than CWSDPMI and it can be bundled with DJGPP programs to make a stand-alone executable that doesn't require a DPMI server to run. PMODE/DJ doesn't support virtual memory and its implementation of the DPMI spec is a bit more restricted than that of CWSDPMI. ... ------------------------------------------------------------------------ So I downloaded and unzipped the pmode11b.zip file. From pmodedj.doc in /v2misc/pmode11b.zip: ------------------------------------------------------------------------ How to use: ~~~~~~~~~~~ - If you want a single executable file, type 'copy /B pmodstub.exe + a.out prog.exe' This assumes 'a.out' is the coff image and 'prog.exe' the name of the final executable. Voila! 'prog.exe' should be fully operational. - To use the TSR version, copy it into the same directory of your program, or somewhere in your path. Then stubedit your program to change the filename of the DPMI provider to PMODETSR.EXE. For quick testing, you can rename PMODETSR.EXE to CWSDPMI.EXE and place it in the same directory as the image being executed. The TSR will only stay resident for a single DPMI program execution (it's really designed to be dynamically loaded) and is not specific to DJGPP (it follows the DPMI 0.9 specification). ... Pitfalls in PMODE/DJ: (read this!!!) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... ) Current DJGPP startup code is incompatible with the stubonly version. The psp address in _go32_info_block is not valid (it's computed based on an assumption of the layout of the stub which isn't true). Even though you may not use the psp address, it is implicitly used by the library function fstat() and routines which may call it. As a work around, use the TSR version, or relink the image using the included CRT1.o which contains a fix for the bug. You might want to insert the fixed CRT1.o into your libc. ... ------------------------------------------------------------------------ I do not understand these instructions! First of all, I am given a method (under "How to Use" above using the "copy /B" command), then later on a pitfall says this won't work and to "relink the image" (what is an "image"?) Object code?) using the CRT1.o file that is included. How is this done? I thought you could only relink "*.o" files; in other words, how do I specify my *.EXE file as input along with the CRT1.O file? What is a "coff image"? Re the TSR method: What is "stubedit"? How would I "change the filename of the DPMI provider to PMODETSR.EXE"? I would appreciate a further explanation of the above in layman's terms! Thanks for DJGPP; keep up the good work.