tags:

views:

199

answers:

1

I'm not sure I understand V8's architecture (yes, I've read its documentation).

In C# with the v8sharp wrapper I write something like this, for example:

namespace App
{
    class Point
    {
        public Point() { }

        public Point(double x, double y) {
            this.X = x;
            this.Y = y;
        }

        public double X { get; set; }
        public double Y { get; set; }
    }
}

static class Program
{
    static void Main() {
        //registering with v8sharp
        V8Engine engine = V8Engine.Create();        
        engine.Register<App.Point>();

        //execute javascript
        object rtn = engine.Execute("new App.Point(10, 10);");
    }
}

How would I write the same thing in Standard C++ without this wrapper?

Thanks.

+2  A: 

If you look here: http://code.google.com/apis/v8/embed.html they have a sample that is identical to yours under "Accessing Dynamic Variables"

Romain Hippeau