The API and ABI for this are tricky to get right.