Hello,
I'm looking for a sanity check. I am trying to wrap the folly::Future class (
https://github.com/facebook/folly/blob/master/folly/futures/Future.h), which doesn't have a default constructor. I've spent a couple hours searching google and this list and understand that Cython can't easily handle such cpp classes because of scoping issues. Most of the topics I've seen are attempting to stack allocate the object on a wrapper class, and this is easily solved by heap allocating the result instead.
However, I'm trying to assign the return value of a method call. I don't think I have the option to heap allocate it. The method signature looks like this:
virtual folly::Future<int32_t> my_func()
Can anyone confirm that this really is impossible before I go about trying to write some sort of C++ shim to take care of it? Is there a recommended pattern for this kind of shim?
For reference, here's the pxd I'm using to wrap the class:
cdef extern from "folly/futures/Future.h" namespace "folly":
cdef cppclass cFollyFuture "folly::Future"[T]:
T get()
cFollyFuture[T]& wait()
and I'm calling with:
cdef Future[int32] future_result = client.my_func()
Thanks for any hints,
Dusty