Re: foreign frame and install_
Haitao Zhang <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFUyvhrY211DnU9f4fqPrB-QTpMjRTvK2OvGGsqFGsHWo12FHg@mail.gmail.com> |
It appears that one can initialize functor_t constants from install_*. But if one creates a term_t through PL_new_term_ref and then unify it with PL_unify_functor the binding is not kept after one exits install_. That is fine but it is a detail that one needs to learn when working with the FFI. On Tue, Feb 4, 2014 at 2:00 PM, Haitao Zhang <[email protected]> wrote: > Previously I asked the following question: > On Tue, Feb 4, 2014 at 12:59 AM, Haitao Zhang <[email protected]> wrote: > >> Incidentally what is the best way to keep a term like FUNCTOR_literal1 >> that is really a constant across foreign calls? >> > > By poking around the swipl source code a little it seems that the answer > is to do all the initializations in the install_(module) function. > Presumably bindings created inside the install_ functions will not be > discarded upon exit unlike regular foreign function calls. > > Haitao > -------------- next part -------------- HTML attachment scrubbed and removed