CGORewritter: A better way to use C library in G

Boyao Ding,Yu Zhang, Jinbao Chen,Mingzhe Hu, Qingwei Li

2023 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)(2023)

引用 0|浏览58
暂无评分
摘要
CGO is a foreign function interface mechanism that enables the creation of Go packages that call C code. It provides a way to reuse legacy C code or high-performance C libraries. However, it is tedious and error-prone to manually write the bindings of C libraries in Go. To make better use of CGO to realize the use of C libraries in Go, we propose CGORewritter in this paper. For a given Go library and corresponding C library, the internal code of the Go API function can be rewritten while keeping the Go API unchanged, and the C API function can be called through CGO in a semi-automatic way so that the application layer program can upgrade without any change. We use this method to rewrite the go/crypto with the OpenSSL library. Experimental results show that the rewritten code maintains full functionality and can be used by application code without modification. Besides, the rewritten code gains a 0.97-3.07× speedup.
更多
查看译文
关键词
bindings,golang,CGO,code generation
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要