[webkit-dev] converting VARIANT array to ArrayBuffer

Anthony Johnson anthony.johnson at flexsim.com
Fri Jun 10 12:59:43 PDT 2011


Hi webkit-dev,
I'm new to webkit, so still learning, but I'm trying to fill in WebKitLib's
WebScriptObject::callWebScriptMethod() functionality in c++ for windows. In
order to do that, I need to convert COM-style VARIANT arguments into
javascript values. I've got the basic types working, but I'm getting hung up
on converting VARIANT arrays. In the end I would like the code to convert a
VARIANT array of primitives into its corresponding ArrayBufferView, and a
VARIANT array of VARIANTs into a javascript array type. Haven't got to the
latter yet, but on the former I can't seem to create an ArrayBuffer or
ArrayBufferView from within WebScriptObject's scope. Here's what I've done.
To create an Int32Array, I first tried including
<WebCore/html/canvas/Int32Array.h>, but apparently the #include <> root
directory for building WebKitLib is actually the Webcore directory in the
distribution folder, and Int32Array.h is not in the distribution folder. So
instead, I tried doing a #include "../../WebCore/html/canvas/Int32Array.h".
That worked (although I bet that's not really kosher). So, once I got that
to work, I then needed to convert the Int32Array into a JSValue. So I used
the toJS() function defined at line 72 of <WebCore/JSArrayBufferView.h>.
That compiled correctly, but then I got linker errors saying that toJS was
an unresolved external symbol. I could probably keep pounding away down this
road until it works, but I figure there's got to be a better way that's
already set up. Could someone show me the right way?
Thanks,
Anthony Johnson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110610/56d1265e/attachment.html>


More information about the webkit-dev mailing list