Deno: Importing a native module

Created on 28 Jun 2018  路  5Comments  路  Source: denoland/deno

I know that using protobufs simplifies the writing of native modules, but how does importing them work?
What's the structure of it supposed to be?
How do we specify how the native module should be built?

Most helpful comment

I'm talking about importing libraries that talk to the underlying operating system.
Some examples would be:

  • Serial Port
  • USB
  • WinAPI

These things are inherently native and can't be 'compiled' to wasm.

All 5 comments

Maybe the solution is to compile native modules to wasm files and import into deno?

I know that with Node.js you can use the WebAssembly.compile() function just like you can in the browser so maybe deno should support this.

I'm talking about importing libraries that talk to the underlying operating system.
Some examples would be:

  • Serial Port
  • USB
  • WinAPI

These things are inherently native and can't be 'compiled' to wasm.

Good point, for legacy software there would need to be a way to interface with it.

But for new software, there are emerging standards like WebUSB that I think deno should adopt.

https://developers.google.com/web/updates/2016/03/access-usb-devices-on-the-web

Before we think about how to have native addons, I want to release a crate #1209 - that provides a way to link in native code (albeit only if you're building your own executable)

Closed in #3372.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xueqingxiao picture xueqingxiao  路  3Comments

CruxCv picture CruxCv  路  3Comments

ry picture ry  路  3Comments

kyeotic picture kyeotic  路  3Comments

somombo picture somombo  路  3Comments