nodejs c++ addon

编译器是C++的编译器(g++?)。官方例子:html

http://nodejs.org/api/addons.htmlnode


民间例子:git

http://cnodejs.org/topic/4f3dc5e19605c56a4b05351fgithub


V8 API文档,写C/C++拓展必备web

这个API的node版本较老, 是10.X的。npm

http://izs.me/v8-docs/annotated.htmlapi


node-webkit 0.10.2基于node 0.11.13工具

只有官方文档ui

http://nodejs.org/docs/v0.11.13/api/addons.html#addons_hello_worldspa


Addon Build工具

建议使用node-gyp,安装方式:npm install -g node-gyp

建议不要用node-waf。

Build CMD: node-gyp configure build 或者 node-gyp rebuild

例子总结

https://github.com/rvagg/node-addon-examples/tree/master/1_hello_world

Github上有Samples。

  1. 须要有binging.gyp告诉node-gyp build的源和目标文件。

格式:

{

  "targets": [

    {

      "target_name": "pidof",

      "sources": [ "pidof.cc" ]

    }

  ]

}

  1. 源文件

C++源文件。

  1. 包信息文件

记录包信息。

相关文章
相关标签/搜索