On Wed, Jan 19, 2011 at 07:07:09AM -0800, Jak Sprats wrote:
> Hi James,
> 
> i am a big fan of boost, especially when it is present in lieu of
> someone writing-their-own-boost :)
> 
> do you have any examples of a C++ program that has a single C function
> {in my case jsCall_client()} that can be called in javascript by
> calling "client()"

#include <vu8/Module.hpp>

void jsCall_client() {
    ...
}

void makeModule(v8::Handle<v8::Context> ctxt) {
    vu8::Module module;
    module.Set<void (), &jsCall_client>("js_name")
    
    ctxt.Set(v8::String::New("mod_name"), module.NewInstance());
    // now any v8 calls in this context can use mod_name.js_name
}

-- 
+44 (0) 7974 159 643 | [email protected] | http://chilon.net

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

Reply via email to