Dynamic Class Loading Idea

Vladimir Panteleev thecybershadow at gmail.com
Sat Nov 3 09:21:01 PDT 2007


On Sat, 03 Nov 2007 15:40:34 +0200, Craig Black <craigblack2 at cox.net> wrote:

>> I like DDL's approach, in which it acts as a run-time linker. It uses
>> relocation data in OBJ files to find address references and fix them (thus
>> "relocating" the code for any memory address) when loading the libraries.
>
> Does this relocation use function pointers?

"Relocation data" is just a list of addresses which have pointers. I didn't express myself correctly, relocation data isn't used to resolve cross-module references. It is only used to "move" that code at a random address. To do that, the linker/loader adds the address to which the code is relocated to each DWORD the address of which is specified in the relocation list.

References are resolved by having a list of symbols, and each symbol having an address of where in this module it's referenced. The linker/loader then simply places the address of each symbol into the referenced locations.

Since this is done before any code in the module is executed, it should be possible to implement on all platforms (except platforms where code and data is strictly separated).

-- 
Best regards,
 Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list