سؤال

I wrote a class header file like this, all steps follows this page cppyy

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;
};

And then compile it

$ genreflex MyClass.h
$ g++ -fPIC -rdynamic -O2 -shared -I$REFLEXHOME/include MyClass_rflx.cpp -o libMyClassDict.so -L$REFLEXHOME/lib -lReflex

Load to pypy-c

$ pypy-c
>>>> import cppyy
>>>> cppyy.load_reflection_info("libMyClassDict.so")

Then I got this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: libMyClassDict.so: cannot open shared object file: No such file or directory

Anyone has encountered this problem, help me please!

هل كانت مفيدة؟

المحلول

(solved after discussion in the pypy mailing list)

The issue was that "libMyClassDict.so" is looked up in the system's standard paths (not including "."). You need to say "./libMyClassDict.so".

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top