Ticket #35 (assigned research)

Opened 3 years ago

Last modified 3 years ago

Replacement of linked symbols at runtime

Reported by: larsivi Assigned to: pragma (accepted)
Priority: minor Milestone:
Component: Runtime Linker Version:
Keywords: Cc:

Description

Or possibly just the program code of the symbol. This would facilitate at least some ability to dynamically replace code at runtime without restarting the app, helping debugging large apps/systems, making it feasible to fix bugs without stopping the app in a critical environment, making it possible for a genetic algorithms program to evolve itself, ...

Of course, just plugging and unplugging of entire libraries (objects) might be enough.

I'm not sure how feasible this really is, but I was inspired by http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/31796

Anyway, I suppose it is at earliest a 2.0 feature.

Change History

01/04/06 20:42:51 changed by pragma

  • status changed from new to assigned.
  • type changed from enhancement to research.

Task changed to 'research' simply becuase I don't have a clue how this should be carried out. Consider the research based tickets here to be the first in line for potential V1 and V2 features. :/

Off the top of my head, I think this would rely on much stronger reflection support. Maybe another layer on top of the current Linker that could become the focus for a reflect API?

auto linker = new ReflectionLinker?(new DefaultRegistry?()); linker.loadAndRegister("insitu.ddl"); auto myClass = linker.getClass("my.name.space.Foobar"); myClass.vtablemyMethod? = &replacementMethod;

Note the lack of involvement with DynamicLibrary?. ReflectionLinker? could also be called a TypeRegistry? or something similar. The types returned from queries like getClass() would be outright TypeInfo? replacements, wrap TypeInfo? instances, or would be more sophisticated subclasses thereof.

I want to move in the direction of runtime code generation anyway, so this is a good place to start I guess.