Re: [pygccxml-development] array_t vs pointer_t
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-04-20 14:53:29
|
Roman Yakovenko wrote: >>>> I'm wrapping a method that takes one single argument of type "double >>>> scale[3]". In the argument list of the corresponding declaration object >>>> this appears as a pointer_t object with a double_t object as base. What >>>> I'm missing is the '3'. >>>> I noticed that pyplusplus defines a type array_t. Shouldn't the above >>>> argument be an array_t instead of a pointer_t to a double? Is this a bug >>>> in pyplusplus, in gccxml or something else? >>> I could be wrong, but this is how C/C++ works. Array is passed by pointers. >>> Am I wrong? Even if I wrong, GCC-XML reports this. >> That's too bad. :( The array size would have been a valuable piece of >> information for creating the wrappers. Without them I have to wade >> through ~250 methods manually to check if the arguments are really plain >> pointers or fixed size arrays as above (which seems to be the majority >> of cases in the Maya SDK)... > > [...] > An other way to solve this issue is to create small parser, that will parse all > header files and will create table with relevant information. Then you > can just use > that information from your script. I took this route and meanwhile I've implemented it. So obtaining the array size is no problem anymore and I could assign argument policies automatically to most methods. Now I have the problem that the argument policy mechanism sometimes produces wrapper methods that are ambiguous. Looks like I have to improve my prototype so that it recognizes these cases and asks for user help. But at least obtaining the array size (what this thread was actually about) works fine. By the way, maybe this code might be useful to some users at some point, so I think it might be worth sharing eventually. But I don't think it's really general and stable enough to be part of the official pyplusplus package, so how about adding a "contrib" directory when the code is moved to svn (maybe pyplusplus_dev/contrib) where contributions from users could be put that is not "good enough" yet for the official package but that might still be useful to the community either as an example for something or as a basis for tailoring it to their own projects? This will be code that does not have to be maintained or supported by yourself (Roman) but users have the option to use it "at their own risk". Such a scheme is used by ODE (Open Dynamics Engine) and only occasionally is code from contrib moved to the main branch when it proves to be useful and becomes stable. - Matthias - |