Skip to content

An example Node.js native addon written in C that needs no external tools other than Node.js and a C compiler

License

Notifications You must be signed in to change notification settings

zeusdeux/c-node-native-addon-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C based minimal Node.js native addon example

An example of a Node.js native addon using C.

No extra tools other than node and a C compiler on $PATH needed for build. node-gyp that ships with node (via npm that ships with node) is used to install node headers.

If you are on windows, you can write a build.bat based off of the Makefile yourself.

To build and run the addon —

npm run build && npm test
# Should print Hello from addon!
# No npm install necessary either btw.

And as always with JS, there's noise to ask kindly to stfu. If npm is yelling about updates, run npm config set update-notifier false to shut it up.

Learnings

  • .node extension is necessary for node to actually load the addon

About

An example Node.js native addon written in C that needs no external tools other than Node.js and a C compiler

Topics

Resources

License

Stars

Watchers

Forks