Hello,

i try to embed a simple object (request, with the method getUrl()) in v8.

i can embed normal functions like this:
global->Set(String::New("log"), FunctionTemplate::New(LogCallback));


if i try to embed a instance of an Object, i get a Segfault:
global->Set(String::New("logObj"), Request::newV8Instance());

and the function:

> Local<Object> Request::newV8Instance() {
>     
>     HandleScope handle_scope(Isolate::GetCurrent());
>     
>     Request* s = new Request;
>     Handle<ObjectTemplate> V8ObjectTemplate = ObjectTemplate::New();
>     V8ObjectTemplate->Set(String::New("getUrl"), 
> FunctionTemplate::New(V8GetUrl));
>     V8ObjectTemplate->SetInternalFieldCount(0);
>     
>     Local<Object> V8ObjectInstance = V8ObjectTemplate->NewInstance();
>     //V8ObjectInstance->SetInternalField(0, External::New(s));
>     
>     return V8ObjectInstance;
>     
> }



running 

global->Set(String::New("logObj"), Request::newV8Instance());
after i created and andered a context using Context::Scope 
context_scope(context); "works" but than the script throws "logObj is not 
defined" if i try to call the function.

any ideas?


-- 
-- 
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/groups/opt_out.

Reply via email to