The medicine to treat adult heartworm is a cyanide. The worms can't process and eliminate it but dogs can.Ivermectin kills the immature worms as a preventative, or along with the other drug in treatment.
Never heard of cyanide being used. Arsenic has been used in doses that were sub-lethal to the dog.