implement hcreate_r, hdestroy_r and hsearch_r