Re: [Vala] Embed Python into Vala, extend Vala with Python



ecir hana wrote:
However, I'm slowly getting lost:
- during compiling, valac says:
pythondemo3.vala.c:43: warning: passing arg 2 of `Py_InitModule4'
discards qualifiers from pointer target type
Is this what you said below about 'emb_methods' being constant?

Yes, that's what I meant.

- looking in your .vapi, what does it mean "..."? Variable number of arguments?

Yes, see: http://www.python.org/doc/1.5.2p2/ext/buildValue.html

This only works in bindings. Currently there's no support for
self-defined functions with variable number of arguments in Vala.

- and what does it mean, that class Object is empty? Doesn't it
matter? Or better yet, what should be inside?

Yes, it doesn't matter for this example. I'm guess there are some
functions ("methods") that operate on PyObject and could belong there.

- arg_parse_tuple(), when converting Python strings to C strings
expects char pointer, is it ok to write &s in Vala?

'char' pointers are usually 'string' in Vala. In your case it's an 'out'
parameter. Your program will work with:

  unowned string s;
  if (!Python.arg_parse_tuple (args, "s", out s)) {
        // ...
  }

's' must be unowned, otherwise Vala would try to free it.


Best regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]