Accessing static data of functions

Ogi ogion.art at gmail.com
Thu Oct 14 14:21:21 UTC 2021


Is there any way to get/set static variables defined in functions 
from the outside? Also, is there any way to access the types 
defined inside in function to get/set their static members?

I’m writing a game engine that should support a dynamic plugin 
system similar to what Manu Evans described in his [Using D 
Alongside a Game Engine](https://youtu.be/FKceA691Wcg) talk. 
Basically, game objects are defined in modules to be compiled as 
DLLs and loaded dynamically. This allows making modifications 
without even restarting the game. Plugin manager detects a 
modification in a plugin source file, serializes all game objects 
into text, unloads a DLL, recompiles it, loads it again and 
deserialize the game objects back.

So far so good, I’m now able to serialize/deserialize game 
objects (including private fields), and any global variables 
defined in a plugin, and any static members of the types defined 
in a plugin. But I don’t know what to do with the stuff that 
could be defined inside of a function, I can’t find any trait or 
a template that could access it.


More information about the Digitalmars-d mailing list