I created an example of a dynamic library in C++
#include <iostream>
extern "C" {
void TaylorSeries(int x1, int x2, int delta_x, double E) {
std::cout << x1 << x2 << std::endl;
}
}
create from this .cpp file dinamic library using commands "g++ -shared -fPIC -o lib.so lib.cpp" and "g++ -shared -o lib.dll lib.cpp" and then import to Python file
from ctypes import cdll
lib = cdll.LoadLibrary('./lib.so')
lib.TaylorSeries(1, 3, 1, 1.0)
i got an error:
lib.TaylorSeries(1, 3, 1, 1.0) # Call the hello function from the library ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ctypes.ArgumentError: argument 4: TypeError: Don't know how to convert parameter 4
I don't know how to solve it because I'm working with dynamic libraries for the first time
I have no idea how to make python understand the double type from C++