Hi,
I have a foreign C library and I have a predicate implemented in C that receives a term that should be stored (for example in a global variable) for further C functions to use it.
I have declared a global variable
In 2013, I was working on Qt ‘porting’ of swipl-win, and Jan explained the necessity to serialize terms to exchange terms between threads:
(from PREDICATE.h)
You indeed need to serialize, but at @peter.ludemann suggested, PL_record() and PL_recorded() are a better choice. They are both faster and cover edge cases such as cyclic terms, internal sharing in terms and attributes.