DLLs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
artrecks
Posts: 23
Joined: Wed Jul 11, 2007 8:24 pm

DLLs

Post by artrecks »

How can I write DLLs for my OS?? How can a program load a DLL and what address should this DLL work?
User avatar
salil_bhagurkar
Member
Member
Posts: 261
Joined: Mon Feb 19, 2007 10:40 am
Location: India

Post 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...
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post 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.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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).
Post Reply