Skip to content

Instantly share code, notes, and snippets.

@3v1n0
Created October 12, 2011 22:55
Show Gist options
  • Save 3v1n0/1282891 to your computer and use it in GitHub Desktop.
Save 3v1n0/1282891 to your computer and use it in GitHub Desktop.
A simple test to use python code from Vala
[CCode (lower_case_cprefix = "Py_", cheader_filename = "Python.h")]
namespace Python
{
public void Initialize ();
public void Finalize ();
[CCode (lower_case_cprefix = "PyRun_")]
namespace Run
{
public void SimpleString (string @string);
}
}
/* Compile with valac --vapidir=. --pkg python pyvala.vala */
using Python;
void main() {
Python.Initialize();
Run.SimpleString("print 'hello from python!'");
Python.Finalize();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment