www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Dynamic Class Loading Idea

reply Bruce Adams <tortoise_74 yeah.who.co.uk> writes:
Daniel Keep Wrote:

 
 
 Craig Black 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?

Here's how I understand it. DDL is a linker. The only difference between DDL and dmd/gcc is that it works at run time instead of compile time. What you described is basically what a linker does, hence what DDL does. -- Daniel

Its also what an operating does to load dynamic link libraries or shared objects.
Nov 03 2007
parent reply "Craig Black" <craigblack2 cox.net> writes:
"Bruce Adams" <tortoise_74 yeah.who.co.uk> wrote in message 
news:fgicuv$11j1$1 digitalmars.com...
 Daniel Keep Wrote:

 Craig Black 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?

Here's how I understand it. DDL is a linker. The only difference between DDL and dmd/gcc is that it works at run time instead of compile time. What you described is basically what a linker does, hence what DDL does. -- Daniel

Its also what an operating does to load dynamic link libraries or shared objects.

Right, but the operating system does not do this when loading dll's or so's at run-time.
Nov 03 2007
parent reply Bruce Adams <tortoise_74 yeah.who.co.uk> writes:
Craig Black Wrote:

 
 "Bruce Adams" <tortoise_74 yeah.who.co.uk> wrote in message 
 news:fgicuv$11j1$1 digitalmars.com...
 Daniel Keep Wrote:

 Craig Black 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?

Here's how I understand it. DDL is a linker. The only difference between DDL and dmd/gcc is that it works at run time instead of compile time. What you described is basically what a linker does, hence what DDL does. -- Daniel

Its also what an operating does to load dynamic link libraries or shared objects.

Right, but the operating system does not do this when loading dll's or so's at run-time.

It depends on the operating system but generally yes it does. On some systems libraries are only loaded when they are first needed. On others they are loaded whent the program starts. And then there's usually a runtime API of some sort. LoadLibrary and GetProcAddress on windows. Those only half count because their too low level. I don't know much about DDL is it OS specific or portable?
Nov 04 2007
parent "Craig Black" <cblack ara.com> writes:
"Bruce Adams" <tortoise_74 yeah.who.co.uk> wrote in message 
news:fgk1n1$et3$1 digitalmars.com...
 Craig Black Wrote:

 "Bruce Adams" <tortoise_74 yeah.who.co.uk> wrote in message
 news:fgicuv$11j1$1 digitalmars.com...
 Daniel Keep Wrote:

 Craig Black 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?

Here's how I understand it. DDL is a linker. The only difference between DDL and dmd/gcc is that it works at run time instead of compile time. What you described is basically what a linker does, hence what DDL does. -- Daniel

Its also what an operating does to load dynamic link libraries or shared objects.

Right, but the operating system does not do this when loading dll's or so's at run-time.

It depends on the operating system but generally yes it does. On some systems libraries are only loaded when they are first needed. On others they are loaded whent the program starts. And then there's usually a runtime API of some sort. LoadLibrary and GetProcAddress on windows. Those only half count because their too low level. I don't know much about DDL is it OS specific or portable?

I think you are talking about delay loaded libraries. I'm talking about libraries that are loaded as plug-ins via LoadLibrary. In this case linking is done with something like GetProcAddress which provides a function pointer.
Nov 05 2007