[C++-sig] indexing suite and py++

Michał Nowotka mmmnow at gmail.com
Mon Apr 13 22:22:47 CEST 2009


>I created the following test case and it works:
>http://pygccxml.svn.sourceforge.net/viewvc/pygccxml?view=rev&revision=1699
>
>I tested it on Wndows, VS 2003, using pygccxml and Py++ SVN version
>and boost version 1.37. I believe the same code will work on Linux
>too.
>
>Can you verify this?

Yes, I found that I used official (from ubuntu repositories) version
of gccxml. When I switched to binaries from gccxml_bin/v09/linux2/bin
everything went ok (whith one exception:
pygccxml/gccxml_bin/v09/linux2/share/gccxml-0.9/GCC/4.3 directory from
SVN version is empty and this causes an error. I copied
gccxml_biuldins.h from
pygccxml/gccxml_bin/v09/win32/share/gccxml-0.9/GCC/4.3).

Ok, but now I want to run all test included.

First of all I can't do it because of an error:

Traceback (most recent call last):
  File "/home/mnowotka/pygccxml/pyplusplus_dev/unittests/test_all.py",
line 113, in <module>
    import indexing_suites_v2_bug_tester
  File "/home/mnowotka/pygccxml/pyplusplus_dev/unittests/indexing_suites_v2_bug_tester.py",
line 14, in <module>
    import dl
ImportError: No module named dl

As far I know, this was a bug in python on x86_64 enviroments. Is
there any way around this dependency?

Secondly, when I exclude indexing_suites_v2_bug test I can see that
not all the other tests were completed successfully:

!  test (custom_smart_ptr_classes_tester.tester_t)  -  FAIL
!  test (deepcopy_tester.tester_t)  -  FAIL
!  test (virtual_inheritance_tester.tester_t)  -  ERROR

Does it mean smart pointers and virtual inheritance is not supported
under linux? Are there any workarounds?

And finally another use case. Consider following code:

#include <utility> //here is std::pair defined

class I
{
public:
	I(int a, int b)
	{
           pair_.first = a;
           pair_.second = b;
        }
	std::pair<int, int> pair_;

int compute(){return pair_.first + pair_.second;}
};

After parsing it Py++ produces warning:

WARNING: std::pair<int, int> [struct]
> execution error W1040: The declaration is unexposed, but there are other
> declarations, which refer to it. This could cause "no to_python converter
> found" run time error. Declarations:   I::pair_ [variable]

I don't understand it because indexing suite v2 can handle vectors,
sets, deques etc. so why pair is here an exception? There is pair.hpp
file in indexing_suite directory so I guess this package can work with
std::pair. Even if I add following lines
(IMO completely useless in this case):

namespace pyplusplus{

     namespace aliases{


        typedef std::pair< std::string, int > PairOfStringInt;
        void instantiate( PairOfStringInt psi){}
        typedef std::pair< std::string, double > PairOfStringDouble;
        void instantiate( PairOfStringDouble psd){}



     }
 }

or:

int a = sizeof(std::pair< std::string, int >);
int b = sizeof(std::pair< std::string, double >);

I still get this warning.

I also read this discussion:
http://sourceforge.net/tracker/index.php?func=detail&aid=1991168&group_id=118209&atid=684318

but adding these lines:
mb.class_('PairOfStringInt').include()
mb.class_('PairOfStringDouble').include()

or:
mb.class_('std::pair< std::string, int >').include()
mb.class_('std::pair< std::string, double >').include()

doesn't solve the problem and generate error:

pygccxml.declarations.matcher.declaration_not_found_t: Unable to find
declaration.  matcher: [(decl type==class_t) and (name==std::pair<
std::string, double >)]

so how should I modify the code to get std::pair exposed?


More information about the Cplusplus-sig mailing list