# c-wrapper-nodejs-addon

> This is start app setup to start writing c/c++ wrapper as node js add-on to use in nodejs. Aim of this project is to include all dependencies needed to use to write wrapper so that a user can just install it using traditional `npm start` command. And then

Latest version **3.0.0** (published 2017-10-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install c-wrapper-nodejs-addon
pnpm add c-wrapper-nodejs-addon
yarn add c-wrapper-nodejs-addon
bun add c-wrapper-nodejs-addon
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2017-10-18 |
| First published | 2017-10-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | Muhammad Shahzad Anjum |
| Maintainers | muhammad-shahzad-anjum |
| Keywords | C, wrapper, c++, wrapper, c, addon, c++, addon, nodejs, addon |

## Links

- npm: https://www.npmjs.com/package/c-wrapper-nodejs-addon
- Repository: https://github.com/muhammad-shahzad-anjum/C-WrapperNodeJSAddon
- Homepage: https://github.com/muhammad-shahzad-anjum/C-WrapperNodeJSAddon#readme
- Issues: https://github.com/muhammad-shahzad-anjum/C-WrapperNodeJSAddon/issues
- npm.io page: https://npm.io/package/c-wrapper-nodejs-addon

## Dependencies (2)

- [node-gyp](https://npm.io/package/node-gyp.md) ^3.6.2
- [windows-build-tools](https://npm.io/package/windows-build-tools.md) ^1.3.2

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2017-10-18
- 2.0.0 — 2017-10-17
- 1.0.0 — 2017-10-17

## README

# C-WrapperNodeJSAddon
This package is to make easy sample to setup initial project to start writing C/C++ code wrapper as add-on to use in node JS. It will make easy to install all dependencies just with  `npm start`.

Important note: BASS DLLs used in this project are added just for learning point of view. For Licenses, must contact corresponding forum.
http://www.un4seen.com/

#### 1. Prerequisites

*nodejs* version 8+ must be installed on your system and the below global node packages must be installed:


#### 2. Cloning the repository

Clone the repository:

> git clone https://github.com/muhammad-shahzad-anjum/C-WrapperNodeJSAddon.git


#### 3. Installing dependencies

Install dependencies by running the following command:
npm install c-wrapper-nodejs-addon
(If it does not clone, then download or clone repo as below)

OR
1. clone to https://github.com/muhammad-shahzad-anjum/C-WrapperNodeJSAddon.git
2. Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7
https://www.python.org/downloads/
Download and install version Python 2.7.14
If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:
$ node-gyp --python /path/to/python2.7
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:
$ npm config set python /path/to/executable/python2.7
3. In console move to project root folder and run
> npm install

#### 4. Building the project

Build the project by running the following command:
Generate the appropriate project build files for the current platform
rebuild -Runs clean, configure and build all in a row
> node-gyp rebuild

Command	Description
help	-Shows the help dialog
build	-Invokes make/msbuild.exe and builds the native addon
clean	-Removes the build directory if it exists
configure	-Generates project build files for the current platform
rebuild	-Runs clean, configure and build all in a row
install	-Installs node header files for the given version
list	-Lists the currently installed node header versions
remove	-Removes the node header files for the given version

`build` directory will be created during the build

#### 5. Starting the application

Start the application by running the following command:

> npm start

The application will be displayed in the browser.

#### 5. Test the application

> npm test

The application will be displayed with the result of all test cases.

Resources
---------
How to Create and Publish Your First Node.js Module
https://medium.com/@jdaudier/how-to-create-and-publish-your-first-node-js-module-444e7585b738

Note: Update and publish changes in existing package
After changing the version number in your package.json, you can run npm publish to publish the new version to NPM.

Node.js v8.7.0 Documentation - C++ Addons
https://nodejs.org/api/addons.html

Node.js native addon build tool - node-gyp
For wrapper it is must to install node-gyp and pythan
https://github.com/nodejs/node-gyp#installation

Microsoft's windows-build-tools
For wrapper it is must to install
Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
https://github.com/nodejs/node-gyp#installation

Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7
https://www.python.org/downloads/
Download and install version Python 2.7.14
If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:
$ node-gyp --python /path/to/python2.7
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:
$ npm config set python /path/to/executable/python2.7

C++ Wrapper links
https://en.wikipedia.org/wiki/Dynamic-link_library#Using_DLL_imports
https://stackoverflow.com/questions/10340552/how-to-pass-a-wrapped-c-object-to-a-javascript-callback
https://stackoverflow.com/questions/38370023/how-to-add-a-method-to-functionalized-module-exports

BASS DLL download and Documentation
http://www.un4seen.com/doc/#bass/BASS_GetVersion.html
http://www.un4seen.com/

Node.js Foreign Function Interface - Not used in this project but helping material
https://github.com/node-ffi/node-ffi

---
_Source: https://npm.io/package/c-wrapper-nodejs-addon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
