Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing a native module #296

Closed
robbym opened this issue Jun 28, 2018 · 6 comments
Closed

Importing a native module #296

robbym opened this issue Jun 28, 2018 · 6 comments

Comments

@robbym
Copy link
Contributor

robbym commented Jun 28, 2018

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?

@styfle
Copy link
Contributor

styfle commented Jul 10, 2018

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.

@robbym
Copy link
Contributor Author

robbym commented Jul 14, 2018

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.

@styfle
Copy link
Contributor

styfle commented Jul 14, 2018

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

@ry ry added this to the future milestone Aug 7, 2018
@ry
Copy link
Member

ry commented Nov 19, 2018

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)

@nayeemrmn
Copy link
Collaborator

Closed in #3372.

@ry ry closed this as completed Dec 17, 2019
@brandonros
Copy link

brandonros commented Dec 8, 2020

How would I implement something like a thin layer above libusb (or the existing rusb crate) with this if the return value for all plugin ops needs to be https://docs.rs/deno_core/0.48.1/deno_core/plugin_api/type.Buf.html?

I might be missing something obvious in terms of how to pass references as Box<[u8]>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants