Hi~
My goal is to call the C++ class methods in a library from jitted functions(in nopython mode). Currently the doc of numba provides ways to handle C struct(here) , and to call the C function in C library(here).
I want to move a little forward. Are there any ways to use the C++ class in jitted funcion, just like we use numpy? The python API of numpy is in a object-orientated stytle. I wonder can I program a library which can be used as numpy. In other word, what is the standard the numpy complies with, which makes it understandable by numba in nopython mode?
Hi Markall!
I think it is not what I need~
I want the cfunc functions to manipulate an object defined in dynamic library, just like manipulating the numpy ndarray.
Not only POD~
I think I should make myself more clear. I hope to progam some C++ extentions in the form of dynamic library. These C++ extentions may define functions, classes. By exposing symbols, these extensions can be imported and used in python.
Although there are several methods to write C++ extensions which can used by python (for example with help with pybind11), these methods are not friendly to numba. I wonder if it is possible to make the C++ dynamic library understanable to numba?
I probally find a solution inspired by this. In this article, it provides a tool to expose C++ function, and static member function to numba. But currently I have not extended it to class member function.
The mechanism is here: It uses a Cstyle function(extern “C”) to get the C++ function address. In python, it uses the “rbc” package to convert the address to a ctypes function(with argtypes and resypes). I think I can use this mechanism I can ecapsulate a C++ class to python. However it is not a direct way.
I still do not know how the numba can recogonise numpy.if I know, I can mimick the numpy to program the C++ extension