Next: , Previous: , Up: lib-structs   [Contents][Index]


10.39.3 Creating and Destroying Foreign Terms

Prolog can create or destroy foreign terms using

new(+Type, -Datum),
new(+Type, +Size, -Datum) and
dispose(+Datum)

where Type is an atom specifying what type of foreign term is to be allocated, and Datum is the foreign term. Type should be an atomic type or a previously-defined type name. The Datum returned by new/[2,3] is initialized to all zeroes. dispose/1 is a dangerous operation, since once the memory is disposed, it may be used for something else later. If Datum is later accessed, then the results will be unpredictable. new/3 is only used to allocate arrays whose size is not known beforehand, as defined by array(Type), rather than array(Num,Type).


Send feedback on this subject.