Here's what I did. http://pastebin.com/m31876b81
you still use static functions, but you associate a class instance when you create the v8 object and then invoke a method on the instance. On Thu, Jan 7, 2010 at 10:02 PM, dominiek <[email protected]> wrote: > Hi there, > > I'm writing a little plugin that allows you to use v8 in the Ruby > programming language. Right now I'm kind of having trouble with > creating a callback to a non-static member function. Basically, the > FunctionTemplate allows me to input a callback, but it's impossible to > simply reference a member function (more about the complexities of > that here: http://www.parashift.com/c++-faq-lite/pointers-to-members.html) > > However, when reading the embedder's guide, it seems that you've > solved this problem already for accessors! > > "The complexity of an accessor depends upon the type of data you are > manipulating: > * Accessing Static Global Variables > * Accessing Dynamic Variables > " > > For the latter, you're using a special mechanism that allows you to > define a static wrapper function, which then uses AccessorInfo to get > a reference to the object. This means that it's possible to call > member functions (dynamic functions of a class instance) when you use > accessors. > > However, it is not possible to use dynamic functions when you use a > FunctionTemplate. Is this correct? > > Is there any hack you can think of that allows me to do it anyway? > Providing callbacks to non-static member functions is essential for > writing scripting language extensions. > > Thanks! > > P.S. My C++ is a bit rusty, but I've been digging into this problem > for quite some hours now. > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- Eric Z. Ayers Google Web Toolkit, Atlanta, GA USA
-- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
