On Tue, Jul 22, 2014 at 6:59 AM, deadmorous <[email protected]> wrote:
> In previous v8 versions (e.g., 3.3.3), a native function passed to
> FunctionTemplate::New() had a return value:
>
> typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
>
> Now things are different:
>
> typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
>
> And now my question: how to migrate native function implementation (return
> value) from v8 3.3.3 to 3.28.31? Or, simplier, just how to return a value
> from native function?

You call `info.GetReturnValue().Set(value)`.  There are a bunch of
overloads for primitive data types (bool, double, int32_t and
uint32_t) plus ease-of-use / efficiency helpers SetEmptyString(),
SetNull() and SetUndefined().

The overloads mean you don't have to `return
handle_scope.Close(Integer::New(42))`, you can just
`info.GetReturnValue().Set(42)`.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to