[pypy-dev] Problems in connecting C++ and python with cppyy
Xia Xin
xiaxinx at gmail.com
Fri May 24 08:45:20 CEST 2013
Hi,
When I use cppyy to connect the C++ with the python, I got a failure.
Following this page, https://pypy.readthedocs.org/en/improve-docs/cppyy.html
Define a new class
$ cat MyClass.h
class MyClass {
public:
MyClass(int i = -99) : m_myint(i) {}
int GetMyInt() { return m_myint; }
void SetMyInt(int i) { m_myint = i; }
public:
int m_myint;
};
then compile it.
$ genreflex MyClass.h
$ g++ -fPIC -rdynamic -O2 -shared -I$REFLEXHOME/include
MyClass_rflx.cpp -o libMyClassDict.so -L$REFLEXHOME/lib -lReflex
$ ls
libMyClassDict.so MyClass.h MyClass_rflx.cpp
BUT, when I tried to load it in pypy-c, error occurred.
$ pypy-c
>>>> import cppyy
>>>> cppyy.load_reflection_info("libMyClassDict.so")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: libMyClassDict.so: cannot open shared object file: No
such file or directory
Help me please? Thanks.
More information about the pypy-dev
mailing list