Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何访问 Vala 中的环境变量?(如上)看起来很简单,但我找不到 g_getenv() 是如何映射到 Vala 中的。
答案在于绑定文件。Vala 使用绑定(在 .vapi 文件中)将其构造绑定到 C 语言。在这种情况下,您可以通过 glib-2.0.vapi(在我的系统上/usr/share/vala-0.10/vapi)进行 grep,您会看到它被绑定为:
/usr/share/vala-0.10/vapi
unowned string? GLib.Environment.get_variable(string name)
掌握核心 VAPI 文件的位置可能非常有用,因为如果您知道函数的 C 名称,您只需 grep 即可。