It's just generating a JS object with the appropriate prototype chain and calling a C++ function with args.This() set. If you want to create a C++ object on the heap you will have to do that manually. You also don't need a constructor and destructor in C++ if you don't want one.. but be sure to free all acquired resources. You will also need to call MakeWeak() to register a callback to know when to destruct your C++ object (v8 doesn't create or destroy C++ objects for you).
On Wed, May 18, 2011 at 7:41 PM, kuno <[email protected]> wrote: > This will be my second newbie question, thanks all. > > Let's say that I just wrote a c++ class, and expose it as a > constructor function in javascript. e.g. > > js code > > <============================================================================= > > var obj = new Constructor_Func(Args); > > obj.method('do something'); > > > =============================================================================> > This is totally ok. > > I am known that c++ is an OOP language, has constructor and > deconstructor. > > But it seems that even I ruined out the constructor and deconstructor > from c++ source code, the code still be able to pass the compilation. > > And the js code still ok. > > How this could be? > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
