Page 1 of 1
DLLs
Posted: Mon Aug 20, 2007 9:08 am
by artrecks
How can I write DLLs for my OS?? How can a program load a DLL and what address should this DLL work?
Posted: Mon Aug 20, 2007 12:21 pm
by salil_bhagurkar
I will give you a basic reply from my restricted knowledge: A DLL basically holds the functions that the program can use during runtime.. So what you could do is define the functions within the DLL and then have structures that mention the addresses of these functions (pointers). So when a DLL is loaded by your program the structures for the corresponding functions within your program will now be replaced by the ones in the DLL. So the pointers of the actual functions are loaded and you can call them...
Posted: Mon Aug 20, 2007 2:37 pm
by jerryleecooper
You can load your dll on the kernel side, or on the program side. On the kernel side, you make new syscall on runtime for your dll, or one declared syscall that you decided that this one will be for this package. And the parameters will be the command, and its parameters. THe advantage will be that the dll will run at the same cpl as the kernel, so if the dll implement a driver or extend one, it runs faster. Or you can have a dll that is loaded in program space, running in the same memory as the program, which I think is how windows work, LoadLibrary("RichEdit.dll") as an example. It's advantage by running côte-à -côte with the program is that it is not penalized by slow interprocess communication, and if it crash, only it and the program crash, and not the whole system.
For loading a dll you need proper floppy disk driver or other storage device driver, to load your code, after that you decide of the file format of your dll, or you take one which already exist, that will skip you from writing new tools.
Posted: Tue Aug 21, 2007 1:46 am
by JamesM
I suggest you look at ELF shared-objects. There are plenty of tutorials out there about them and AFAIK the standard is more defined and more open-source than Microsoft's dynamic link libraries. (They serve the same purpose, by the way).