When you call the _context->Global()->Get function what is returned is
a Function which inherits from Object.  I usually do the following:

Handle<Function> objectFunction = Handle<Function>::Cast(_context-
>Global ()->Get (String::New ("object")));

Then you can call objectFunction->GetPrototype().


Corey


On Oct 13, 9:12 am, "Florent Steiner" <[EMAIL PROTECTED]>
wrote:
> Hi corey !
>
> I've tried that :
>
>     Handle<Value> oVal = _context->Global ()->Get (String::New ("object"));
>     if (oVal->IsObject ())
>     {
>         Handle<Object> o = Handle<Object>::Cast (oVal);
>
>         Handle<Object> oProt = Handle<Object>::Cast (o->GetPrototype ());
>
>         oProt->Set (String::New("ToJSON"), FunctionTemplate::New(::ToJSON),
> DontEnum);
>     }
>
> But I got this error when I compile :
>
> 1>c:\msdev6\myprojects\jss\jss\..\V8\include\v8.h(198) : error C2440: '=' :
> cannot convert from 'v8::FunctionTemplate *' to 'v8::Value *'
> 1>        Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
> 1>        .\JSS.cpp(64) : see reference to function template instantiation
> 'v8::Handle<T>::Handle<v8::FunctionTemplate>(v8::Handle<v8::FunctionTemplate>)'
> being compiled
> 1>        with
> 1>        [
> 1>            T=v8::Value
> 1>        ]
>
> Best regards,
> Florent Steiner
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to