PDA

View Full Version : Dynamic Linking in DOS... important!



minime6696
01-26-2002, 07:29 AM
I have tried a few things, and I just can't get a fast way to make "drivers", or simply seprit files for seprit 'jobs'.

The first attempt that worked was makking an exe that on execution would take paramiters as to what proc and what args, but it was too slow and consumed too much memory.

I suppose I could do a "constant file reader" thing... but there must be a better way!

How is HIMEM.SYS and all of that stuff that seems to be dynamic binary work in DOS?

SPH

VirtualAce
01-26-2002, 11:50 PM
I wouldn't call HIMEM.SYS dynamic. It is a TSR, just like EMM386.
For dynamic loading of code you would have to use actual DLLs - it is possible in DOS and can be done through DJGPP.

To implement your own you would load your code with the appropriate call to DOS. Don't call DOS EXEC because that will run the code - you just want to load it. Check RBIL for the correct register values when you do the DOS int.

After you load the code, you will have access to the functions in it simply by altering your data segment and so forth. However, I think DLLs have a header in them that tells you at what offsets the functions lie within the code stream. That way you can just jump to the function or even only load that function instead of the whole DLL into memory.

For more info on doing DLLs within DJGPP, check the FAQ or their website at www.delorie.com - I'm sure you know the URL, but just in case.

I don't know the file format or header format for a Microsoft Windows DLL or if they did at one time have a DOS DLL format. Just don't know.

Check Randall Hyde's AoA for more info on using shared memory, semaphores, and dynamic linking. You could do it yourself, or you could do some research on MS DLLs and how they work and load. Would be very interesting.