[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to keep a copy of emacs_env or ert in module ?

From: Philipp Stephani
Subject: Re: how to keep a copy of emacs_env or ert in module ?
Date: Tue, 13 Sep 2016 06:18:26 +0000

hx <address@hidden> schrieb am Di., 13. Sep. 2016 um 02:02 Uhr:

On Sun, Sep 11, 2016 at 4:02 PM, Philipp Stephani <address@hidden> wrote:

hx <address@hidden> schrieb am So., 11. Sep. 2016 um 06:30 Uhr:
is it possible to keep a copy of the *env in module ?

No. emacs_env, emacs_runtime, and emacs_value objects are only valid within the dynamic extent of the function they are created/passed in. You can't keep them around. The only exception are global references, created by make_global_ref.

instead of copy the pointer, I copy the struct content:

emacs_env genvo;
emacs_env *genv = &genvo;

emacs_module_init(struct emacs_runtime *ert)
  emacs_env *env = ert->get_environment(ert);
  genvo = *env;

it is working. 

Only by accident in the current implementation. Please don't do this; it's not guaranteed to work, and may stop working at any time. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]