Hot code reloading simply doesn't work on either of my Macbook Pros (ARM and x86). Does anyone know why? It seems there's quite a few issues discussing this.
Since I'm not expecting hot reloading to be patched anytime soon. Can I just use std/dynlib on a dynamic library built with nim for the functions it contains?
Thanks for your reply. I've tried out dynlib and hit a snag. I'm writing a game.
Is it possible to link to a dependency/nim module dynamically? I'm trying to emulate Handmade Hero's setup. That is:
Now in A, I dynamically load B, using std/dynlib. The issue is: when B is loaded dynamically, I get a duplicate symbol error due to C being loaded already in A (which I believe is due to sokol-nim being static linked to both A and B). How can I over-ride this? I'm using nimble, but nimble seems to be getting in my way for this custom buildscript.
I assume with hotcode reloading this would be trivial, but considering it doesn't seem to be working for me on x86 (libhcr.dylib not found) and ARM (same error or segfault).
I have got this setup with CMake using C++. Where B and C (my third party dependencies) are compiled to dynamic libraries and A is simply an executable file.
Do you or anyone else have any recommendations? Is this possible to do with nimble or is there any specific compiler flags I should use here?
Don't write your game so that you need hot-code-reloading. The technology just isn't there and most games that ever got finished and sold have been developed without it.
Write a load/save game feature and use that to continue from you left off. And implement some cheat codes. Users appreciate these features too.
This is for the development process, aiming to obtain an interactive experience. This would not be there for production. I may want to do something similar with a plugin system, if that's possible, though I'm not planning to implement that.
At the moment the only way I can see how to do the above is to force compilation to C files, parse the JSON produced by the compiler and compile the files manually to a dll/dylib with a custom build script. I haven't done this, as it's quite a bit of effort, so I am not sure if this works.
I have been exploring the compiler a bit more and trying to understand how the standard library is compiled to a dll, which it seems there is one file importing all the standard library modules.
Question: if I dedicate one nim file to the imports of my dependencies (e.g. other nim modules or some modules compiling C files such as sokol), is it possible to compile this module to a dll and then use this dll for the imports it references to in other parts of my program? If so - how do I do this?
Previous iteration of my engine did this - https://github.com/zacharycarter/frag-old
It's totally doable with std/dynlib. If you're compiling to C++, expect a more difficult time.