Extracting C functions signatures for Erlang

只愿长相守 提交于 2019-12-12 09:55:10

问题


I was wondering what the most suitable tool is for extracting c (and eventually c++) function names, arguments and their types from source code. I would like to use a tool that can be automated as much as possible.

I want to extract the signature types then have the output read by another program written in Erlang. My goal is to use this information to construct the equivalent of the C types/signatures in Erlang (using ei). I would like this process to work for any C file so I can't use any hardcoded stuff.

I have found a lot of tools that look promising like CLang, CScope and ANTLR and so on but I don't know if any of them will work or if there is a better approach out there.

Thanks.


回答1:


Surely there is something better, but if you don't find it:

gcc -aux-info output demo.c
sed '/include/d' output

Extracts functions form source code skipping standard functions



来源:https://stackoverflow.com/questions/17163583/extracting-c-functions-signatures-for-erlang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!