From: Ilya Ryzhenkov Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer,comp.os.msdos.djgpp Subject: Re: DOS-based DLL system Date: Tue, 13 Oct 1998 23:54:34 +0600 Organization: iNetLab Lines: 62 Distribution: world Message-ID: <362393DA.AE33780A@inetlab.com> References: <3622729c DOT 417426724 AT newshost DOT cc DOT utexas DOT edu> <36235C46 DOT 8C452D20 AT arx DOT com> NNTP-Posting-Host: ppp3.isp.nsc.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.03 [en] (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello there! Black Phantom wrote: > > > > I'm interested in creating some sort of DLL (Dynamic Link Library) > More likely it will be harder than you describe: you'll write a TSR that [ skipped ] IMHO the world is much brighter than you described. The Ultimate DOS Dynamic Load Library Which Will Deal With Any DOS Programs - yes, it's a beast hard to implement. But if we are speaking of a particular compiler and library to dynamicaly load code - I see not so much problems. At first you should see, that one can safely call DATA in DOS environment - so you can simply alloc some memory, load DLL image into it, then get symbol address (somehow - depends on the DLL layout and your goals) and call the pointer. That is how it was done in Windows DLL system - you ask to load dll, then ask for pointer to function and then just call it via pointer. Import lib funcs are just wrappers to this scheme. Another way is to create a wrap to the whole program - as it was done in my DLM engine. Special stub starts before all your code and creates the dynamic environment. What it actually load are object files. It resolves symbols and call the main. It also export LoadDLM and other API functions for modules to be able to access DLM engine features. As you see no TSR or DOS hacking required. > 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? There are much more reasons to use dynamic linking/loading than you mentioned. They include : - loading drivers - are you going to link in your exe ALL possible drivers and thus make you program unextendable ? Or you prefer to make several DRV/DLL/DLM's which share interface and contain code specific for the device ? - plugins - common object interface will help you to create installable plugins - overlays. In low memory environment you can load/unload parts of you program as needed. - there are some more. anyone can easely continue the list. ============================ Ilya P. Ryzhenkov aka Orangy Fido : 2:5000/120.7 E-mail : orangy AT inetlab DOT com ICQ : 17942172