Open ivalylo opened 3 years ago
Hi @ivalylo
there is a wrap_function()
helper in v8pp/function.hpp
that allows to wrap any callable C++ object (pointer to free function, lambda, maybe also std::function
) to a V8 Function value. So you could try to use the wrapped function as a callback argument.
Btw, there is also a call_v8()
helper in v8pp/call_v8.hpp
that seems to be very similar to your V8CallFunc::operator()
.
It seems that proper support for std::function overload for v8pp::convert require including full content of call_from_v8.hpp and call_v8.hpp. It can be easily done from the technical point of view, but I have no idea about the architectural point of view.
I made my ugly version using forward declaration, but it doesn't work if used doesn't include call_v8.hpp or call_from_v8.hpp or both while using std::function bindings. And there are not so clear messages "undefined reference to v8::Local<v8::Value> v8pp::call_v8<double>()
"
What do you think, @pmed?
Hi @YarikTH
do you mean PR #169? Thanks, it looks viable, maybe with a test case added.
I hope call_v8()
can be used somehow inside convert<std::function<>>
specialization. Anyways call_v8()
i just a helper for v8::Function::Call()
, that we can use in the specialization.
Yes. But I gave up using V8 a long time ago so I can't collaborate more.
Hello,
Seems this is not supported currently, but it's quite handy to have (for example callbacks). I tried implementing it, but I'm very new to both v8 and v8pp. Also not that good with template programming either. But here is something I got working, and maybe can be used to build somewhat better implementation.