Skip to main content
gamedev.net
🔒 Locked

DLL's

Started by danielk 0 replies 750+ views
Original Post
danielk
danielk
Hey guys! Quick question: Does anyone know the file format of a DLL, I mean, is it actually "dynamically linked"? Or is it just a collection of pre compiled code, in which the getProcAddress scans the file for the compiled function and returns a function pointer to that region of memory. By the way, when a function pointer is called, does it completely ignore the size of the function and just execute a "ret" command? Why? I''m trying to write a custom dll loader for xbox... Yes I''m stupid (;0) Thankyou for any feedback, all the best, Dan
Transformers Rulez!!
Zipster
Zipster
A DLL is really just an EXE without all the stuff that helps it load itself - "ready-made" code, I like to call it I would imagine it''s similar to, if not the same as, the EXE file format, which I think is called PE. I don''t know, but I think you might even to be able to export functions from an EXE EXE''s and DLL''s are refered to as "modules" interchangebly in the docs, and it''s understood what''s being refered to by the context. As for "dynamically linked", that means that the program doesn''t know what code will be executed until runtime. This is why DLL systems are neat, because you can interchange DLLs with identical functions but entirely different code without having to recompile the program. It just runs whatever code the DLL has

Anyway, the DLL contains a table of the functions it exports, and when you get the address of a function with GetProcAddress, it checks this table to see where in the DLL the function starts, and returns that pointer.

quote:
By the way, when a function pointer is called, does it completely ignore the size of the function and just execute a "ret" command?

It''s the job of the function being called to return from, er, itself. So all you do is call the function pointer and it returns when it returns.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.