So, let's say that I keep all the entity related code, along with all the other systems together in the game code DLL. If you're right then compile time isn't going to be an issue, so let's rule that out.
Let's go back to structs instead. What happens if the struct of an entity changes? Those that have been created before the change would need to be invalidated and/or the whole executable should reload and start from scratch, or at the very least call some initialization function to recreate the current level or whatever the main environment of the game is.
Would there be any better way to manage this kind of changes?
To hotswap changes to entity struct you need:
1. Metadata/reflection - that is to parse C/C++ (or use some macro/template markup thing)
2. Entity structs have to be in hot-swapable portion
And then you can either serialize(old) into deserialize(new) entities from disk or memory. The serialization has to include metadata headers. Or generate code which maps the differences between entity metadata in new DLL vs old DLL.
Honestly this is a huge pain in the ass to do in C/C++. Totally worth it though.
This is fairly easy to do in Dlang and modern pascal dialects (both have fairly fast compilers)
This is easy to do in C# (and alike), but it's hard to make the serialization/deserialization/state-mapping fast (because it's almost impossible to memcpy most things in C#, and working with value types has been cumbersome up to C#7).
It would be really easy to do in JAI as it has fast compiler + metadata + compile time execution. I wouldn't be surprised if John had some sort of system in the works for his games which hotswaps everything (including datastructs) in way less than a second.
Hell, if he gets rid of the slow MS linker and puts on fast codegen I'm sure JAI could also do *interactive framerates* hotswapping. It would be really cool.