Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore ctypes for python bindings #65

Open
cissieAB opened this issue Nov 6, 2024 · 0 comments
Open

Explore ctypes for python bindings #65

cissieAB opened this issue Nov 6, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@cissieAB
Copy link
Collaborator

cissieAB commented Nov 6, 2024

https://docs.python.org/3/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference

Yatish mentioned current Python binding
Reassembler.getEvent/recvEvent(recv_buf: List) -> Tuple[int, int, int, int]

for Reassembler::getEvent and Reassembler::recvEvent is not natural, especially using Python List as the data buffer and then decode List[0] only.

I used Python List because at that moment, List is the only native Python object I could think of which is mutable and match the underlying C++ ** interface.

He recommended to look into Python ctypes package that we could pass variables by reference in Python. It can also reduce the data copies between Python and C++. That's definitely worth looking into.

@cissieAB cissieAB self-assigned this Nov 6, 2024
@cissieAB cissieAB added the enhancement New feature or request label Nov 6, 2024
@cissieAB cissieAB changed the title Explore ctypes for python bindings for more natural bindings and reduce memory copy between Python and C++ Explore ctypes for python bindings Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant