Comment #2 on issue 195 by chad.retz: Swig script to create bindings
http://code.google.com/p/v8/issues/detail?id=195
Ok, I have a hello world working in Java w/ my SWIG iface (attached). For
any
curious, you will need to copy SWIG_HOME/Lib/stdint.i to where the
attached .i file
is + util/stdint_mod.i and remove the #include for <stdint.i> when building
w/ VC.
Here's the hello world in Java:
System.loadLibrary("jav8");
V8HandleScope handleScope = JaV8.getGlobalHandleScope();
V8PersistentContext context = V8Context.New();
V8ContextScope contextScope = new V8ContextScope(
new SWIGTYPE_p_HandleT_v8__Context_t(context.getCPtr(), true));
V8HandleString source = V8String.New("'Hello' + ', World!'");
V8HandleScript script = V8Script.Compile(source);
V8HandleValue result = script.Run();
V8StringAsciiValue ascii = new V8StringAsciiValue(
new SWIGTYPE_p_HandleT_v8__Value_t(result.getCPtr(), true));
System.out.println(ascii.__ref__());
When running the above, make sure you have the built SWIG DLL on the
library path (or
the current path) along w/ v8.dll. Obviously the above is ugly and will
receive some
cleanup. I am not posting to this issue any more about it, but once I am up
and
running w/ satisfied test cases, I will start a project and open source it.
Watch out
Rhino, here I come!
Attachments:
jav8.i 9.6 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev