These functions implement the old API to get a list of Kerberos hosts, and are thus similar to the krb5_krbhst_init functions. However, since these functions returns all hosts in one go, they potentially have to do more lookups than necessary. These functions remain for compatibility reasons.
After a call to one of these functions, hostlist is a NULL terminated list of strings, pointing to the requested Kerberos hosts. These should be freed with krb5_free_krbhst when done with.
The following code will print the KDCs of the realm "MY.REALM".
char **hosts, **p;
krb5_get_krbhst(context, "MY.REALM", &hosts);
for(p = hosts; *p; p++)