mirror of
https://github.com/jorisvink/kore
synced 2025-03-10 04:59:02 -04:00
This allows modules that have global pointers to upon reload repopulate those with the addresses of when they were first created. Meaning it now is easier to write modules that can be reloaded if those modules kept global state one way or the other. This should only be used at module init/reload time and is very simple: if ((ptr = kore_mem_lookup(MY_ID_VALUE)) == NULL) { ptr = kore_malloc_tagged(length, MY_ID_VALUE); /* initialize for the first time. */ } If we were in a reload the kore_mem_lookup() will return the original address returned by the initial kore_malloc_tagged() call for MY_ID_VALUE.