Message-ID: <36235C46.8C452D20@arx.com> Date: Tue, 13 Oct 1998 15:57:26 +0200 From: Black Phantom X-Mailer: Mozilla 4.5b2 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer,comp.os.msdos.djgpp Subject: Re: DOS-based DLL system References: <3622729c DOT 417426724 AT newshost DOT cc DOT utexas DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 212.25.66.71 X-Trace: 13 Oct 1998 15:51:17 +0200, 212.25.66.71 Lines: 24 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > > I'm interested in creating some sort of DLL (Dynamic Link Library) > -like ability in a DOS-based program, using DOS-targeting compilers > (DJGPP, QuickC, or a variety of older assemblers). Is this something > I'd have to write a library for, like a DLL handler that would load > the DLL, retrieve function locations, and have a handler function that > would take the desired DLL function and manually handle the stack and > IP register to call it? Or is there a simpler way that I'm missing? More likely it will be harder than you describe: you'll write a TSR that intercepts DOS program loader, calls the original loader (or loads a program itself), then checks whether the loaded program contains imports and resolves the relocations. Alsom you'll it will have to provide with its own service analogue to "LoadLibrary", to load imports at run-time rather than at load-time. You will hav to decide: to use DOS 'MZ' EXE format, extending it to contain import/export tables (say somewhere at the end of exec. image) or adopt 'NE' format where that tables are already included; you'll have to write libraries, of course, also. The whole thing is utterly inefficient since dynamic linking was designed for sharing one copy of library among different address spaces. In DOS there is a single-tasking environment so DLL system will eat up a lot of memory, saving nothing. What do you need it for, what is the design goal?