On Fri, Mar 27, 2009 at 7:46 PM, <[email protected]> wrote: > object wrapped up? As I am using static accessors I wouldn't have any > other way to > get my global (c++) object instance besides using the same mechanism > as on > my other v8 wrappers..
Yes you can - the trick is to simply define a no-op destructor for the static instance (or change your destructor to somehow recognize that a given object is static/shared and should not be destroyed). i do this with a couple wrapped classes. e.g.: typeof new PathFinder() == PathFinder (or maybe "object") typeof PathFinder.shared.plugins == PathFinder (or maybe "object") where PathFinder.shared.plugins is simply a static/shared instance of that class which is bound using the exact same mechanism as the non-shared instances. In this case, my constructor takes one extra step of "new ..." was called, so that the object gets cleaned up. For shared instances it does not set up the destructor bits. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
