为Erlang提取C函数签名 [英] Extracting C functions signatures for Erlang

查看:94
本文介绍了为Erlang提取C函数签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道最合适的工具是从源代码中提取c(以及最终c ++)的函数名称,参数及其类型。我想使用一种可以自动完成的工具。

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.

我想提取签名类型,然后让其他用Erlang编写的程序读取输出。我的目标是使用此信息来构造等效于Erlang中的C类型/签名(使用ei)。我希望此过程适用于任何C文件,所以我不能使用任何硬编码的东西。

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.

我发现很多工具看起来像CLang,CScope和ANTLR等,但我不知道它们中的任何一个是否可行,或者是否有更好的方法。

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.

谢谢。

推荐答案

当然还有更好的方法,但是如果您找不到它,则:

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

这篇关于为Erlang提取C函数签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆