Giter Club home page Giter Club logo

jsni's Introduction

jsni

version travis build BSD-3-Clause License downdloads

jsni is the interface for JavaScript and C/C++, which is vm neutral and keeps abi/api compatible.

So the developers can avoid rewriting their native modules once v8/nan or other vms api changes.

It is acronym for JavaScript Native Interface.

Usage

Prerequisites:

  • node 7.x or above
  • npm

We can try jsni beginning with the hello-world example.

First, clone it to your local machine.

git clone https://github.com/alibaba/jsni.git -b example

Second, install jsni using npm:

cd jsni/hello-world/
npm install jsni

Finnally we can build and run it:

node-gyp rebuild
node test.js

And it will show "hello".

The essential JavaScript code is like this:

var jsni = require("jsni");
var addon = nativeLoad("addon");
console.log(addon.hello());

Documentation

API Reference

Collaborators

License

BSD-3-Clause

jsni's People

Contributors

jinderek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsni's Issues

npm test does not work on Ubuntu

This may be a bug of node-gyp. It SHOULD NOT generate jsni.a in Debug/obj.target/../jsni.a.
It SHOULD generate in Debug/obj.target/jsni.a.

make: Entering directory `/workspace/jenkins/tmp/jsni/test/build'
  g++ '-DNODE_GYP_MODULE_NAME=jsni' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DDEBUG' '-D_DEBUG' '-DV8_ENABLE_CHECKS' -I/home/jenkins/.node-gyp/8.9.4/include/node -I/home/jenkins/.node-gyp/8.9.4/src -I/home/jenkins/.node-gyp/8.9.4/deps/uv/include -I/home/jenkins/.node-gyp/8.9.4/deps/v8/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -g -O0 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Debug/.deps/Debug/obj.target/jsni/../src/jsni.o.d.raw   -c -o Debug/obj.target/jsni/../src/jsni.o ../../src/jsni.cc
  rm -f Debug/obj.target/../jsni.a && ar crs Debug/obj.target/../jsni.a Debug/obj.target/jsni/../src/jsni.o
  rm -rf "Debug/jsni.a" && cp -af "Debug/obj.target/../jsni.a" "Debug/jsni.a"
cp: cannot stat 'Debug/obj.target/../jsni.a': No such file or directory

add test for npm run test

Now we only have example code under branch example.
But we should have test under branch master, so we can test directly after code is modified, like using npm run test.

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.