Initialization / Deinitialization

Handles are used by the API to keep track of state. The type of a handle is proctal_t.
A handle must not be used simultaneously in multiple threads, however, it is possible to use multiple handles as long as they are used in different threads and are not accessing the same program.
Handles are created by calling the proctal_open function. It takes no arguments and returns a new handle.

proctal_t proctal = proctal_open();

Check the Error handling page to learn how to deal with an error. An error at this stage is not recoverable, so you have to destroy the handle. How to destroy a handle will be explained in a few sentences.
A new handle has all of its state set to default values. To set which program you want to access you need to call proctal_pid_set. It takes a handle and an id as arguments.

proctal_pid_set(proctal, 12345);

On Linux, the id must be a PID (Process ID).
When you're done using the handle you must destroy it by calling the proctal_close function. It takes a handle as argument.