On Monday, 16 June 2025 at 07:30:31 UTC, rempas wrote:
So, I wanted to create a library to allow D to be used a scripting language, in order to allow it to be used to configure programs. Now, the design of everything is rather simple. However, I do have one problem. Is there a way to pass runtime information of a struct, to the compiler that will compile my code?

If what you desire is run-time configuration then the path forward is to invoke compiler say via std.process and compile your config to shared object. After that if compile is successful dlopen + dlsym is the way to go.

If what I want to do is not possible, I guess that another idea would be to get compile time information about a struct, write it to another file and automatically have the compiler add that file (if that's even possible)? Or maybe, modify the script file to add an **import** statement to it. Any ideas?

There is import(“some_file”) to import files as data, but I’m not sure if that is what you are looking for.



Reply via email to