>> If all you want to do is wrap a single function, an add-on library like >> v8-juice or vu8 is way overkill. i'd start by taking a look at shell.cc >> inthe v8 source tree.
Hi Stephan, advice like this is golden. I am trying to not to add bloat, but I have no idea where to start, so the answer, "your use case is simple enough to go directly into the internals" is one I hear very gladly. So in shell.cc, it looks like ExecuteString() would be a pretty good embedding point ... this is pretty much the code Vyacheslav is describing below. So this is half of the puzzle, I can embed v8 now (this looks like a very clean embedding implementation for javascript) ... now the other half, calling C from JS... I am not finding an example of that in shell.cc I have the feeling, I am very close to getting this, but I still dont fully get how to register a C function to be called when a JS function is called. - Jak On Jan 18, 7:59 am, Stephan Beal <[email protected]> wrote: > On Tue, Jan 18, 2011 at 4:35 PM, Jak Sprats <[email protected]> wrote: > > <huge snip> > > ...man-days embedding V8 and then using v8-juice to implement the JS func > > > "client" would take? (just ballpark: is it a day, a week, a month?) > > i couldn't even guess. AlchemyDB and reddit are both foreign words to me, so > i couldn't even venture a guess. > > > What would be REAL helpful is if there was a hello-world for embedding > > v8 in C > > There is a hello-world (the shell app) in the v8 source tree. Binding that > with C requires a C++ middle-man API which has functions the C code can call > (i.e. they use export "C"). Aside from that, there should be no magic > involved. > > If all you want to do is wrap a single function, an add-on library like > v8-juice or vu8 is way overkill. i'd start by taking a look at shell.cc in > the v8 source tree. > > -- > ----- stephan bealhttp://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
