Minimize usages of legacy C API inside the library
Merge pull request #824 from taka-no-me:reduce_c_api_deps