Leon
Leon

Reputation: 2069

Implement derived class in Python while the base class be coded in C++

I have built a soft platform. It supports many "Widget" running on it. The platform is a Linux natural C++ application. The so-called "Widgets" are all derived class of one same base class, and implement a same API, linked into many *.so file respectively (one Widget live in one so).

The platform loads Widget by calling dlopen( "widget_name.so" ), and runs one Widget in one thread. When I implement many Widgets in C++, everything is OK so far, but now I need let my platform can run/support Widgets those be coded in Python by other programmers(They are not familiar with C++).

I studied embedding-python-in-c and CFFI, but they mainly talk about calling/linking Python with C, and I can't find any information about "How to implement derived class in Python that inherited from a base in C++".

My question is:

  1. Can I implement such a derived class in Python while its base class coded in C++?
  2. Can these derived class in Python call/interact with other objects in C++?

Upvotes: 0

Views: 188

Answers (0)

Related Questions