[pypy-dev] cppyy comments/questions

Uwe Hoffmann uwe.ng at family-hoffmann.de
Mon Aug 13 15:49:25 CEST 2012


   i'm not sure if this is the correct mailing list as this is more a
   question of "developing with" than "developing of" pypy.

   I made some tests with cppyy and it looks promising but I have some

   preface: Tested with trunk and the reflex-support branch.
            building with:
    python translate.py -O jit --gcrootfinder=shadowstack \
              targetpypystandalone.py --withmod-cppyy
    64-bit linux , gcc 4.6.1

   1) During build/translation there were several errors
      like "undefined reference to `Reflex::Member::~Member()".
      This was caused by not linking against libReflex.
      With some modifications (some insertions of
      (lib,"Reflex") e.g. ) in  pypy/translator/tool/cbuild.py
      i got a working (but see later) module. But what's the correct
      way of doing the build. The "cppyy use case question" thread
      mentions the problem but i didn't see the solution.

   2) On importing some wrapped "c++ libs" the displayed error is very
      generic. The following patch gave me some hints what's wrong .

    diff -r 26b81a6d9365 pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py	Fri Jun 29 12:26:46 2012 +0200
+++ b/pypy/module/cppyy/interp_cppyy.py	Fri Aug 10 23:30:30 2012 +0200
@@ -22,7 +22,7 @@
         cdll = capi.c_load_dictionary(name)
     except rdynload.DLOpenError, e:
-     raise OperationError(space.w_RuntimeError, space.wrap(str(e)))
+     raise OperationError(space.w_RuntimeError,space.wrap(str(e.msg)))

    3) playing with operators.h in pypy/module/cppyy/test/:
       (m_int made public before test)
       the following lines results with the expected output "10"
import cppyy
number = cppyy.gbl.number
print n.m_int

      but if i add "virtual" to "operator==" like
      virtual bool operator==(const number& n) const {return m_int == 
n.m_int; }
      the output is not deterministic anymore.
      This needs to be confirmed as my setup is probably not correct
      (see point 1).

    4) During one test i got the following error:
       TypeError: none of the 1 overloaded methods succeeded. Full details :
         A* B::C::methodName() =>
           AttributeError: '<type '::'>' has no attribute ''

      (A and C are types (classes), B is a namespace)
      Generally speaking: What's the best way for debugging this problem.


More information about the pypy-dev mailing list