I dont care who's tooting the horn as long as it sounds good :)

This seems to be what I am looking for ... some questions:
1.) AlchemyDB is written in ANSI-C, what are the requirements for your
bindings (C++ at a minimum, any specifics on that)
2.) I just need one function wrapped, the function is called
"client()" and it can take between 1 and 6 arguments.

And on a long shot, do you know of any C programs that embedded V8 and
then the embedded v8 calls a C function via your bindings. This is
what I am trying to reproduce in AlchemyDB (the C function would be
"client()").

My intent w/ this is to open up Javascript routines w/in AlchemyDB
that can access AlchemyDB's data-structures and perform logic
datastore side. Pairing this w/ AlchemyDB's Node.js client could
provide a very interesting architecture where ALL logic (client,
server[Node.js], datastore[AlchemyDB) could be done in Javascript,
meaning high reusability of JS libs accross an entire system.

On Jan 16, 6:12 am, Stephan Beal <[email protected]> wrote:
> On Sun, Jan 16, 2011 at 12:43 PM, Jak Sprats <[email protected]> wrote:
> > Does V8 embedding have something like this, so not only a way to call
> > Javascript from C, but also a way to call C from Javacript?
>
> There is, but only if you use C++ glue to bind your C API to v8's C++ API,
> which in turn binds to JS space.
>
> If i may be so bold as to toot my own horn for a moment, i believe i've
> implemented the world's simplest-to-use binding mechanism for wrapping C
> functions (from C++) in v8. Here's an example of all the code one needs to
> bind sleep() to v8:
>
> jsObj->Set( String::New("sleep"), FunctionTemplate::New(
>       convert::FunctionForwarder<1>::Invocable<unsigned int,unsigned
> int,::sleep>
>     )->GetFunction() );
>
> About 50% of that code is required by v8 (i.e. unavoidable, regardless of
> the wrapping framework) and the other 50% is invoking one of my templates
> which creates a new v8::InvocationCallback function (with compile-time type
> safety and no dynamic memory costs) which acts a proxy for sleep().
>
> More on this topic can be found here:
>
> http://code.google.com/p/v8-juice/wiki/BindingFunctions
>
> --
> ----- stephan bealhttp://wanderinghorse.net/home/stephan/

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

Reply via email to