Accessing static data of functions
Tejas
notrealemail at gmail.com
Tue Oct 19 11:28:29 UTC 2021
On Thursday, 14 October 2021 at 14:21:21 UTC, Ogi wrote:
> 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.
Seeing the turn this thread has taken, could you file an
enhancement request at bugzilla for this particular case? It
doesn't seem like it was a design choice to disable your
requested behaviour, nor will it break anything.
Hopefully a like-minded individual can make a PR.
More information about the Digitalmars-d
mailing list