On Wednesday 25 May 2011 14:12:31 John Cummings wrote: > Hello BR, > > Thank you for the suggestion. It is certainly a step in the right > direction. However, I'm a bit perplexed by the particular example > because it is modifying a function. In my example, I am trying to modify > a member variable (actually, in my real library bindings, I am trying to > wrap a static class member but I suspect it is similar). > > In looking at more of the typesystem_sample.xml file you referred me > too, it seems that perhaps I need to add a conversion-rule tag since I > am dealing with a primitive-type tag, which does not accept the > inject-code tag as a child (or inject-code doesn't allow primitive-type > as its parent). I'm not entirely clear how this will work for an array, > but I'll start chipping away at it. Any pointers would be greatly > appreciated.
Any function that gets arrays on their arguments must be treated as special cases, because there's no way to create a heuristic that will do the right thing in all cases :-/ What you really need to do to fix your function depends on the semantics of your function and how you want to export it to Python. > Thank you > John Cummings > > On 05/24/2011 04:39 PM, Renato Araujo Oliveira Filho wrote: > > Hi John, > > > > This array type need be implemented manually because this is a complex > > operation and this depends of the c++ function. > > Take a look on this sample[1] on shiboken test library, you can find a > > way to handle this. > > > > > > [1]https://qt.gitorious.org/pyside/shiboken/blobs/master/tests/samplebind > > ing/typesystem_sample.xml#line880 > > > > > > BR > > > > On Tue, May 24, 2011 at 1:56 PM, John Cummings <[email protected]> wrote: > >> On 05/24/2011 11:43 AM, John Cummings wrote: > >>> Hello, > >>> > >>> I received the warning message: > >>> > >>> skipping field 'scalar' with unmatched type size_t > >>> > >>> in my bindings and simplified the problem to make it happen when > >>> building a modified version of the libfoo example. > >>> > >>> I found this thread from the mailing list that included a partial > >>> solution: > >>> > >>> http://groups.google.com/group/pyside/browse_thread/thread/b17ebb2a0b8e > >>> 9698/97e1a0d0832ffc9d > >>> > >>> The basic answer was twofold. First, use the proper include file. I > >>> added the <cstddef> header in my case. This addition didn't seem to > >>> make a difference for me. The second part was to explicitly tell the > >>> generator what a size_t should be: > >>> > >>> <primitive-type name="size_t" default-constructor="0" > >>> target-lang-api-name="PyLong" /> > >>> > >>> This method generally works, however, I have two issues with this > >>> approach: > >>> > >>> 1. Is a PyLong really the same as size_t on all platforms (32/64 bit, > >>> Linux, Windows, Mac, etc.)? > >>> 2. This approach doesn't seem to work for array types. > >>> > >>> On the not working with an array, I modified the libfoo example and > >>> added two public member variables: > >>> > >>> size_t scalar; > >>> size_t array[2]; > >>> > >>> That is, one regular variable and one array. The regular variable > >>> compiles just fine. The array variable does not compile and fails as > >>> follows using 1.0.2 release on 64-bit Linux: > >>> > >>> math_wrapper.cpp: In function ‘int Sbk_Math_set_array(PyObject*, > >>> PyObject*, void*)’: > >>> math_wrapper.cpp:360:10: error: ‘isConvertible’ is not a member of > >>> ‘Shiboken::Converter<long unsigned int []>’ > >>> math_wrapper.cpp:365:56: error: ‘toCpp’ is not a member of > >>> ‘Shiboken::Converter<long unsigned int []>’ > >>> > >>> The array syntax has obviously confused the generator. I just tried > >>> changing the C++ code to use an "int" instead of size_t and I get > >>> basically the same error. Perhaps I have unwittingly uncovered a larger > >>> bug, although I suspect I have simply missed some documentation. > >>> > >>> I can certainly file a bug report if necessary. > >>> > >>> Thank you > >>> John Cummings > >>> _______________________________________________ > >>> PySide mailing list > >>> [email protected] > >>> http://lists.pyside.org/listinfo/pyside > >> > >> The Google link I sent apparently requires a login, try gmane instead to > >> enjoy login-free browsing: > >> > >> http://article.gmane.org/gmane.comp.lib.qt.pyside/1589/ > >> > >> My apologies for sending a semi-hidden link. > >> > >> > >> _______________________________________________ > >> PySide mailing list > >> [email protected] > >> http://lists.pyside.org/listinfo/pyside > > _______________________________________________ > PySide mailing list > [email protected] > http://lists.pyside.org/listinfo/pyside -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
