Part of my troubles may be related to not fully understanding the way v8 is setup. To give an overview of what I am trying to do, I am attempting to load many scripts within their own context that will have the same structure. I want to then call various functions / obj- methods at various points in my code. Below are links to the code that I have created thus far (I am pasting this to insure I am utilizing v8 properly).
CV8Script.h -- http://pastebin.com/ExSuLKpH CV8Script.cpp -- http://pastebin.com/sWWs9B73 CV8Core.cpp -- http://pastebin.com/qhgfqb95 When I first started to use v8, I was having trouble simply getting it to work at all. I resolved this by creating a HandleScope inside my main function: int main(int argc, char* argv[]) { v8::HandleScope HandleScope; CApp theApp; return (int)theApp.OnExecute(); // Everything happens inside of here } This feels very hackish to me, but I can understand that scripts need a scope to run in. Using my classes above, I create / run scripts like this: CV8Script Script; // Member of CApp Script.OnLoad("test.js"); Script.Run(); // This works Script.Call("OnLoop", i); // This does NOT work My script is: function OnLoop(x) { var Buffer = ""; for(var i = 0;i < 100;i++) { Buffer += i; } return 1; } I receive an Access Violation inside of v8::internal::Invoke when I attempt to use my Call method. My debugger points me to the line after my Func->Call inside of CV8Script::Call (which makes me think it may be related to cleaning up). Any help solving this would be appreciated. My setup: Windows 7 x64 Visual Studio 2008 Standard Thanks. -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
