Proctal

Documentation

Allocating memory

To allocate memory in another program you must call the proctal_allocate function. It takes a handle and the number of bytes as arguments and returns an address to the start of the new memory location.

void *address = proctal_allocate(proctal, 8);

On failure the address will have the value NULL. Check the Error handling page to learn how to deal with an error.
While the function may allocate more space than you had specified, you must only consider the number of bytes you specified as usable.
Access permissions can be defined by calling the proctal_allocate_read_set, proctal_allocate_write_set and proctal_allocate_execute_set functions before proctal_allocate. By default all access permissions are set.

proctal_allocate_read_set(proctal, 1);
proctal_allocate_write_set(proctal, 1);
proctal_allocate_execute_set(proctal, 0);

To deallocate you must call the proctal_deallocate function. It takes a handle and the address to the start of the memory location as arguments.

proctal_deallocate(proctal, address);