add pure-C API

This should be API compatible with the new API you added in 5.0, although almost certainly not ABI compatible (C function names aren't mangled).