V8 javascript wrapper for native windows dll

200 views
Skip to first unread message

jfc

unread,
Aug 20, 2009, 3:07:03 PM8/20/09
to v8-users
Does anyone have an example/howto on the following:

An existing windows dll that provides some functionality like char*
getMessage().

Create a V8 javascript wrapper to call this C/C++ function from
javascript.

Finally working this all work within Chrome.



Thanks,

Stephan Beal

unread,
Aug 20, 2009, 7:06:36 PM8/20/09
to v8-u...@googlegroups.com
On Thu, Aug 20, 2009 at 9:07 PM, jfc <jfcek...@gmail.com> wrote:

Does anyone have an example/howto on the following:

An existing windows dll that provides some functionality like char*
getMessage().

Binding a DLL wrapper is identical to binding your own code to v8. 90% of the wrapping process is converting the application data to/from JS/C/C++. There is no special interface for wrapping DLLs. You simply create a binder function (or class, or family of functions) for the APIs exported by the DLL.
 
Create a V8 javascript wrapper to call this C/C++ function from
javascript.

This is documented fairly well on the v8 home page (http://code.google.com/p/v8/) and is demonstrated in the code of several v8-based libraries, such as (but not limited to):

http://code.google.com/p/v8-juice/
http://code.google.com/p/cproxyv8/
http://code.google.com/p/v8cgi/

(An interesting URL pattern appears.)
 
Finally working this all work within Chrome.

AFAIK, this could only be made visible to Chrome if Chrome supports loading native plugins AND it exposes the JS engine to those plugins. i have no idea if it does either of those (still waiting on Chrome for Linux).

--
----- stephan beal
http://wanderinghorse.net/home/stephan/
Reply all
Reply to author
Forward
0 new messages