The following snippet of code uses the ham_attach|detach_self() functions:
... ham_entity_t *ehdl; /* The entity Handle */ int status; /* connects to a HAM with a heartbeat of 5 seconds and an entity name of "client1", and no flags it also specifies hpdh = 4, and hpdh = 8 */ ehdl = ham_attach_self("client1", 5000000000, 4, 8, 0); if (ehdl == NULL) { printf("Could not attach to Ham\n"); exit(-1); } /* Detach from a HAM using the original handle */ status = ham_detach_self(ehdl,0); ...