Giter Club home page Giter Club logo

denoffi's Introduction

deno_plugin_ffi (WIP & Need Help)

Build Status tag Crates.io Docs.rs license

Deno Foreign Function Interface.

deno_ffi is a Deno plugin for loading and calling dynamic libraries using pure JavaScript/TypeScript. It can be used to create bindings to native libraries without writing any Rust code.

It also simplifies the augmentation of Deno with Rust/C/C++ code as it takes care of handling the translation of types across JavaScript/TypeScript and C/Rust, which can add reams of boilerplate code to your otherwise simple C/Rust. See the example/ for an example of this use case.

Example

import * as ffi from "https://deno.land/x/ffi/mod.ts";

const libm = ffi.Library('libm', {
  'add': [ 'int', [ 'int', 'int' ] ]
});
libm.add(1, 2); // 3

// You can also access just functions in the current process by passing a null
var current = ffi.Library(null, {
  'btoa': [ 'string', [ 'string' ] ]
});
current.btoa('1234'); // MTIzNA==

License

deno_plugin_ffi is released under the MIT License. See the bundled LICENSE file for details.

denoffi's People

Contributors

justjavac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.