Created
October 12, 2011 22:14
-
-
Save astagi/1282808 to your computer and use it in GitHub Desktop.
Just a simple experimental way to embed python in Vala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valac python.vapi pyembtest.vala -X -I. -X -I/usr/include/python2.6 -X -lpython2.6 -o pyembtest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Python; | |
void main(string[] args) { | |
Python.Initialize(); | |
Run.SimpleString("print 'hello from python!'"); //just an Hello World | |
Python.Main(args); //your args for Python | |
Python.Finalize(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* python.vapi generated by me, modify it if you need ^^. */ | |
[CCode (lower_case_cprefix = "Py_", cheader_filename = "Python.h")] | |
namespace Python | |
{ | |
public void Initialize (); | |
public void Finalize (); | |
public void Main([CCode (array_length_pos = 0.1)] string[] args); | |
[CCode (lower_case_cprefix = "PyRun_")] | |
namespace Run | |
{ | |
public void SimpleString (string @string); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pyembtest.vala:6.5-6.26: error: Non-abstract, non-extern methods must have bodies
public void Initialize ();
^^^^^^^^^^^^^^^^^^^^^^
pyembtest.vala:13.9-13.32: error: Non-abstract, non-extern methods must have bodies
public void SimpleString (string @string);
^^^^^^^^^^^^^^^^^^^^^^^^
pyembtest.vala:8.5-8.20: error: Non-abstract, non-extern methods must have bodies
public void Main([CCode (array_length_pos = 0.1)] string[] args);
^^^^^^^^^^^^^^^^
pyembtest.vala:7.5-7.24: error: Non-abstract, non-extern methods must have bodies
public void Finalize ();
^^^^^^^^^^^^^^^^^^^^
Compilation failed: 4 error(s), 0 warning(s)