7

How do I access environment variables in Vala? (as above) it seems simple, but I can't find how g_getenv() is mapped into Vala.

1 Answer 1

11

The answer lies in the bindings file. Vala uses bindings (in .vapi files) for binding its constructs to the C language. In this case you can grep through glib-2.0.vapi (on my system that is in /usr/share/vala-0.10/vapi), and you'll see that it is bound as:

unowned string? GLib.Environment.get_variable(string name)

It can be quite useful to have the location of the core VAPI files handy, because if you know the C name of a function you can just grep for it.

1
  • Thanks Michael, you went further than answering my question :)
    – kaStevie
    Dec 21, 2010 at 1:47

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.