Peeking into Memory

The following operations can be used to peek into memory. They can be used in conjunction with the foreign interface to peek into data structures within foreign code from Prolog. These operations take an integer argument and access the data stored at the address represented by the argument. Note that these operations can result in segmentation faults and bus errors if the argument you are trying to access is a bad address or if the address is not aligned properly for the data you are going to access from it. The only sure way of getting an integer in Prolog that represents an address that makes sense is by returning an address from a foreign function through the foreign language interface (see fli-p2f-poi). For built-ins that poke ("store") values into memory, see the reference page for assign/2 in the reference section. For more structured ways of doing this, see the Structs and Objects packages.


integer_8_at(X)
Evaluates to the signed byte stored at address X.
unsigned_8_at(X)
Evaluates to the unsigned byte stored at address X.
integer_16_at(X)
Evaluates to the signed short stored at address X.
unsigned_16_at(X)
Evaluates to the unsigned short stored at address X.
integer_at(X)
Evaluates to the signed integer stored at address X.
address_at(X)
Evaluates to the address stored at address X.
single_at(X)
Evaluates to the single precision floating point number stored at address X.
double_at(X)
Evaluates to the double precision floating point number stored at address X.