Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Wrapped C++ objects so instanceof operator works
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stephan Beal  
View profile  
 More options Jun 7 2010, 4:08 pm
From: Stephan Beal <sgb...@googlemail.com>
Date: Mon, 7 Jun 2010 22:08:30 +0200
Local: Mon, Jun 7 2010 4:08 pm
Subject: Re: [v8-users] Wrapped C++ objects so instanceof operator works

On Mon, Jun 7, 2010 at 4:45 PM, Martin Cohen <martin.bala...@gmail.com>wrote:

>        m_instances.insert( std::make_pair( object, js_object ) );
>        // Set the internal field value to the C++ object
>        js_object->SetInternalField( 0, v8::External::New( object ) );
>        return js_object;
> ...
> However a returned object has no class name set, so the "instanceof"
> operator does not work. From what I've learned, the "instanceof"
> operator works using the object.prototype.constructor property, though
> I'm not sure how to correctly set it up in this wrap function.

If you want to skip a lot of trial and error, and jump right into your
coding, i strongly recommend using one of the several 3rd-party libs which
take care of those bits for you.

A partial list (the ones i know about):

http://code.google.com/p/v8-juice (that one's mine! :)
http://nodejs.org/
http://code.google.com/p/cproxyv8/
http://code.google.com/p/v8cgi/

Slapping a single class binding together isn't too much work (once you've
done it a few times), but if you want to bind more than a couple classes, a
generic framework for doing so is in order. The above libraries provide such
features, each with varying strengths and weaknesses.

--
----- stephan beal
http://wanderinghorse.net/home/stephan/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.