malramsay64 / 2d-packing

0 stars 0 forks source link

Link C codebase to python using some tool #4

Open malramsay64 opened 5 years ago

malramsay64 commented 5 years ago

At this point I am not sure what will be the most appropriate approach for this linking step since there are so many different tools available. Here I am looking for the simplest approach.

malramsay64 commented 5 years ago

I am using pybind11 which has been relatively simple to implement. All of the definitions of the classes occurs in C++ which is a little complicated, however it is possible to set any of the parameters, including dunder methods with C++ functions. It also supports custom getters and setters for parameters which is nice. There is also the ability to allow modifications by python of the C++ class, which can make it even more pythonic.

It is a little complicated to use with template functions, requiring a specific instantiation of the template. Additionally where there are multiple methods with different arguments it can be a little complicated.