This short writeup will guide you through creating a simple node.js addon
- Read this short description on how to build a simple nodejs addon on windows.
- Download node.js sources.
- Make sure you have Python 2.x installed (not 3.x).
- Build node sources by running `vcbuild.bat'.
- Verify that node.lib is located under the Debug/ directory.
- Fire up VS2010 and create a new C++ Empty CLR project.
- Open the project properties (Click Alt+Enter while the project file is selected)
- Set the project type and extension project type should be dll and the extension should be .node
- Set the include directories as follows (replace paths with the local nodejs source path).
- Set the libraries directories as follows (replace paths with the local nodejs source path).
- Add a new CPP file and call it SOME_PREFIX_Addon.cpp. This file will hold the actual addon definitions and dll entry point.
- Open the property pages of the new CPP file you created.
- Change the "Common Language Runtime Support" option to No Common Language RunTime Support
- use the project provided here as an initial implementation.
- take a look at the following html presentation. the ppt explains the different steps necessary to register a class with V8.
- start rocking!