You might simply have a syntax error. The '=' symbol in your function
declaration is incorrect. Try:
function test() {
return "success";
}
or :
test = function() {
return "success";
}
On Jun 23, 4:01 pm, Kelly <[email protected]> wrote:
> Am I missing some simple step in properly building/using v8, or is
> something else wrong?
>
> I'm building v8 for android but the results differ from older v8
> binaries. Whenever I call any function (native or local) I get bad
> returns. These worked fine when I linked to the libv8.a in the android
> platform.
>
> I have a test function(javascript):
>
> function test() = {
> return "success";
>
> }
>
> and I call this through v8 after I have run a file containing it (with
> no errors using persistent global context 'context_'):
>
> TryCatch tc;
> v8::Handle<v8::Value> arg = v8::String::New("argument");
>
> Handle<String> process_name = String::New("test");
> Handle<Value> process_val = context_->Global()->Get(process_name);
>
> LOGI("Test for valid function");
>
> if (!process_val->IsFunction())
> {
> LOGE("Failed to get test()!");
> return;
> }
> else
> {
> LOGI("Grabbed function test()!");
> }
>
> Handle<Function> process_fun =
> Handle<Function>::Cast(process_val);
>
> // Store the function in a Persistent handle, since we want that
> globally
> Persistent<Function> test =
> Persistent<Function>::New(process_fun);
>
> LOGI("Calling test()");
> result = test->Call(context_->Global(), 0, &arg);
> LOGI("called! test()");
>
> but my result is always empty. This happens on native javascript
> functions as well. And if I write bad code within the function or pass
> a bad arg to eval() it returns an empty result, with NO EXCEPTION! So
> not only is it busted, but error reporting isn't happening.
>
> I was previously linking to the libv8.a out of the android platform
> and the same exact code works fine.
>
> I added some logs in v8 to see what was going on. The 'file(line):'
> info is probably much more useful than my text:
>
> /v8test.cpp(295): Calling test()
> /api.cc(2769): V8 ping
> /execution.cc(124): Calling Invoke()
> /parser.cc(1337): result == NULL
> /top.cc(690): Stack overflow!!
> /execution.cc(124): Calling Invoke()
> /runtime.cc(7003): stack overflow
> /top.cc(690): Stack overflow!!
> /execution.cc(108): Pending Exception!!
> /top.cc(925): external_caught!! Uncaught RangeError: Maximum
> call stack size exceeded
> /execution.cc(108): Pending Exception!!
> /top.cc(925): external_caught!! Uncaught RangeError:
> Maximum call stack size exceeded
> /api.cc(2772): V8 ping
> /api.cc(2773): We have pending exception!!
> /v8test.cpp(299): called! test()
>
> And then the result and exception are empty..
>
> I've been working on this for a while.. and /frustrated.. Anyone have
> any info the help?
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users