add C API implementation