Yes. Just use it directly in the Cython file the same as you're using
the first library (and, of course, don't forget to link it). Wrapping
is only necessary if you want to expose it to Python.
- Robert
Yep.
> It works, but do i need to add all the methods provided by QString or
> is there another way?
Only the ones you need to use.
- Robert
VlcInstance takes a QString, but args is a Python object. You have to
create a QString before passing it into the VlcInstance constructor.
(If QString is just a special kind of string, it probably has a
constructor taking a char*, right? The usual caveats about unicode vs.
byte strings apply.)
- Robert
Could you perhaps post all your files (including your .cpp file)?
- Robert
Instance.pyx will automatically generate Instance.cpp, don't list the
latter. This is probably what your problem is.
Well, what is a QString? Is it some kind of a string with special
structure attached? The two most obvious solutions to me would be to
either provide a QString wrapper, or convert it into a Python unicode
object and return that (the latter if the conversion is lossless).
- Robert
> On 18 nov, 04:42, Robert Bradshaw <rober...@math.washington.edu>
> wrote:
Cython doesn't know anything about QString, so doesn't natively know
how to turn a QString* into a Python unicode object. Cython can
however convert between Python objects and char*. Surely there's some
QString method to get an encoded representation of the string as a
char*, say UTF-8, which you can then turn into a Python unicode. See
http://docs.cython.org/src/tutorial/strings.html for more than enough
information regarding how to properly handle unicode.
The same goes for QList, etc. You'll probably want to write utility
methods that convert back and forth between Python objects and all of
these types. I'd imagine such a thing would be generically useful to
others as well.
- Robert