Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nbind

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nbind

Embind-style bindings generator for Node.js

  • 0.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
149
increased by0.68%
Maintainers
2
Weekly downloads
 
Created
Source

nbind

build status npm version

nbind is a bindings generator for Node.js plugins inspired by embind from emscripten. The bindings are built along with your C++ library without requiring any generated code, using C++11 templates and simple declarations.

It's at an alpha stage and many embind features are missing, but for usage instructions much of the embind documentation is appropriate. The included example (available on GitHub, omitted from npm package) illustrates the basic idea, a simple C++ Point class is defined with no JavaScript-related code. Only the following is required to add support for using it from JavaScript:

#include "nbind/Binding.h"

using namespace nbind;

NODEJS_BINDINGS(Point) {
    class_<Point>("Point")
        .constructor<>()
        .constructor<double,double>()
        .function("add",&Point::add)
        .function("print",&Point::print);
}

NODE_MODULE(example,Bindings::initModule)

It can then be used like this:

var Point=require('bindings')('example').Point;

var a=new Point(1,2);
var b=new Point(10,20);

a.add(b);

To compile the example, install required packages for both nbind and the example, build and run inside the example directory:

npm install
cd example
npm install
node point.js

License

The MIT License Copyright (c) 2014-2015 BusFaster Ltd

FAQs

Package last updated on 18 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc