Hi, I'm trying to export the following code to python, but failed. Please
help me!
Here is the code:
--------------
c++ code:
--------------
class IWorker {
public:
virtual int getData() = 0;
};
class Worker : public IWorker {
public:
int getData() {
return 100;
}
};
extern "C" {
IWorker* createWorker();
}
--------------
py++ code:
--------------
mb.free_fun('createWorker').call_policies =
call_policies.return_value_policy(call_policies.return_pointee_value)
--------------
In python:
--------------
>>> w = createWorker()
I got 'TypeError: No to_python (by-value) converter found for C++ type:
class IWorker
I found that if the IWorker class is not abstract, for example:
class IWorker {
public:
virtual int getData() { return 0; }
};
Python doesn't report that error, but the result of the following code is
not expected(I think it should be 100).
>>> w = createWorker()
>>> w.getData()
0
How to solve this problem? Please give some advise.
THANK YOU.
--
View this message in context:
http://boost.2283326.n4.nabble.com/help-on-abstract-class-export-tp3483090p3483090.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig