Aurélien Aptel <address@hidden
> schrieb am Fr., 10. Feb. 2017 um 19:21 Uhr:
> I tried putting all the interned symbols in a struct and passing specifying
> it as a data pointer when constructing the functions. However, this did not
> work as the emacs_value objects does not seem to have a lifetime outside of
> the invocation of a native function. I haven't seen this documented
> anywhere, so that was a bit surprising at first. The fact that this failed
> is the reason you see all the calls to env->intern everywhere.
This was not always the case: the behaviour was changed by Philipp at
some point. We still have the make_global_ref and free_global_ref
functions in the API, which serve no purpose as a result (correct me
if I'm wrong).
Using make_global_ref is definitely intended to make objects usable across environments (i.e. you should be able to use them in any thread whenever any environment is active). If that's not the case, please report a bug.
The alternative of using intern everywhere is also not too bad because it's much simpler and more obvious (no global state that you have to track carefully). I'd recommend only switching to global references if there is a significant performance penalty.