On Sat, Nov 26, 2011 at 9:32 PM, Roman Shtylman <[email protected]> wrote:
> Then I call a function using the c++ api 'Call' and provide an array of > arguments, how should I handle the scope for those arguments? Do I still > need to do things like scope.Close? or can I just pass the array to the > function call. What happens to the locals if there is no scope.Close and > the c++ stack frame exits? If the code which is using Call() is itself called from JS then you already have an implicit Scope and you don't need to create one (i never do). If the code using Call() is NOT being called from JS, or otherwise does NOT have a Scope somewhere in the... well, the scope, then you should/must use a HandleScope. Whether or not Close() is necessary depends (from what i understand) only on whether or not you want to return a value owned by that Scope to a higher-level scope, in which case you should pass it to Close(), e.g. return myHandleScope.Close(myValue). If you don't need to return it, you don't need to bother with Close() (just let the HandleScope go out of scope and destruct). -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
