I am sorry to revive an old thread, but I am running in to the same
issue. I am trying to make a JSR-223 compatible Java bridge to V8. I
also need dynamic function binding. I am unable to see the pastebin
since it has expired. Can someone repost?

Also, I prefer to use pure V8 w/out the v8-juice project. Does anyone
know the best way to dynamically bind functions at runtime? I was
considering binding all functions to a single function and obtaining
some form of unique identification from the Arguments object. Any help
is appreciated.

On Jan 8, 5:42 am, Stephan Beal <[email protected]> wrote:
> On Fri, Jan 8, 2010 at 4:02 AM, dominiek <[email protected]> wrote:
> > 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.
>
> A callback to a non-static member function always requires an instance of
> that class. Aside from that, binding a member function is very similar to
> binding a non-member function (with the additional step of decoding the
> native "this" object before calling the native member function).
>
> The v8-juice project provides support for binding any of the following C++
> constructs to v8:
>
> - free functions
> - member functions (if the class containing the member is also wrapped)
> - member variables, either via the Accessor interceptors or by binding
> functions to them, such that the functions are called in place of the
> get/set operations.
> - static variables, whether member or free.
>
> You might find it useful for your project.
>
> The main project page:http://code.google.com/p/v8-juice/
>
> Some useful wiki pages:
>
> How the type conversions 
> work:http://code.google.com/p/v8-juice/wiki/ConvertingTypes
> (that part is central to the whole binding mechanism)
>
> Binding free functions:http://code.google.com/p/v8-juice/wiki/BindingFunctions
>
> Binding classes (including member 
> funcs/variables):http://code.google.com/p/v8-juice/wiki/ClassWrap
>
> > P.S. My C++ is a bit rusty, but I've been digging
> > into this problem for quite some hours now.
>
> Given that: be aware that generic binding mechanisms require either code
> generators (i'm not aware of any for v8, unless one counts macros) or rather
> intricate templates-based mechanisms. Thus you may want to brush up on your
> C++ before undertaking any significant JS/C++ binding projects. Simple (or
> "brute force") bindings can be done without too much C++ know-how, but
> generic solutions to the problem require a fairly good understanding of C++
> templates (or a hypothetical code generator).
>
> --
> ----- stephan bealhttp://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to