Native Modules

54 views
Skip to first unread message

Joel Scarfone

unread,
Jul 17, 2019, 4:02:06 PM7/17/19
to v8-users
How can i embed v8 such that I can provide a native module? For example:

import {foo} from 'FooBar';

foo();

How can i get foo() to call into native code?

J Decker

unread,
Aug 1, 2019, 1:29:30 PM8/1/19
to v8-users
Maybe there's some hints here for how node does it.... there's very little to node that is on the C(++) side...
https://github.com/nodejs/node/tree/master/lib/internal/modules/cjs
Though that doesn't help actually embedding it.
Although Node does also provide modules like 'os' 'process' ... 

Sven Sauleau

unread,
Aug 2, 2019, 7:37:25 AM8/2/19
to v8-u...@googlegroups.com
Hi,

I recently played around with the proposal https://github.com/WebAssembly/esm-integration in v8.
My plan (which I haven't discussed with the v8 folks) was to create a new class that extends the JavaScript Module class and add it to the public API.

It should allow to return a compiled Wasm module in the ResolveCallback passed during the JavaScript Module instantiation. I know it's not strictly C++ code but maybe I can help you.

Sven

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/0c439fa4-a5c4-49b2-9924-a05eedb76b25%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages