Returning C++ buffer to Python 2.7
I've allocated memory in C++ and need to expose a function to Python so that Python can read this memory as a sequence. I've found this example http://pastebin.com/YGi61R4H from this URL http://stackoverflow.com/questions/16232520/how-to-expose-raw-byte-buffers-w... which **looks** like it will do what I need, from the description of the code and the request from the original author. However, it looks incomplete to me. There is no code which defines, or explains what *handle<>* is/does, in this line of code object retval = object(handle<>(py_buf)); I would appreciate some help trying to accomplish this (my statement in the first line of this message). Useful (working) examples of Boost-to-Python code are not easily found outside of Stackoverflow. Thanks Tony
________________________________ From: Tony Cappellini <cappy2112@gmail.com> To: cplusplus-sig@python.org Sent: Thursday, October 15, 2015 10:27 PM Subject: [C++-sig] Returning C++ buffer to Python 2.7
I've allocated memory in C++ and need to expose a function to Python so that Python can read this memory as a sequence.
I've found this example
from this URL http://stackoverflow.com/questions/16232520/how-to-expose-raw-byte-buffers-w...
which **looks** like it will do what I need, from the description of the code and the request from the original author.
However, it looks incomplete to me. There is no code which defines, or explains what handle<> is/does, in this line of code
See http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/pytho... explanation of handle<>
See
http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/pytho... explanation of handle<>
Thank You!
participants (2)
-
Tony Cappellini -
Trigve Siver