博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NodeJS开发c++扩展模块
阅读量:2390 次
发布时间:2019-05-10

本文共 929 字,大约阅读时间需要 3 分钟。

建立测试模块代码FaceRecognition.cpp

#include 
using v8::FunctionCallbackInfo;using v8::Isolate;using v8::Local;using v8::Object;using v8::String;using v8::Value;void CAMOpen(const FunctionCallbackInfo
& args) { Isolate* isolate = args.GetIsolate(); args.GetReturnValue().Set(String::NewFromUtf8(isolate, "cam_open..."));}void init(Local
exports) { NODE_SET_METHOD(exports, "CAMOpen", CAMOpen);}NODE_MODULE(FaceRecognition, init)

建立编译文件binding.gyp

{  "targets": [    {      "target_name": "FaceRecognition",      "sources": [ "FaceRecognition.cpp" ]    }  ]}

安装编译环境

npm install -g node-gyp

安装python

conda create -name python27 python=2.7

activate python27

编译器

本人的编译环境是vs2015

编译模块

node-gyp configure build

创建测试文件test.js

const FaceRecognition = require('./build/Release/FaceRecognition');console.log(FaceRecognition.CAMOpen());
测试

开发NodeJS扩展模块也可以使用Native Abstractions for Node.js

https://github.com/nodejs/nan

你可能感兴趣的文章
站在巨人肩膀上的牛顿:Kubernetes和SAP Kyma
查看>>
删除所有正在运行和退出的docker实例
查看>>
SAP官方发布的ABAP编程规范
查看>>
ABAP文档生成工具
查看>>
SAP S/4HANA extensibility扩展原理介绍
查看>>
我在德国做SAP CRM One Order redesign工作的心得
查看>>
如何给SAP云平台的账号分配Leonardo机器学习服务的实例
查看>>
一些通过SAP ABAP代码审查得出的ABAP编程最佳实践
查看>>
如何用Visual Studio Code远程调试运行在服务器上的nodejs应用
查看>>
Association, Composition and Aggregation in UI5, CRM, S/4HANA and C4C
查看>>
ABAP很厉害是怎么一种体验?
查看>>
CRM数据库表COM_TA_R3_ID的数据来源
查看>>
如何从ERP下载Sales BOM到CRM
查看>>
如何用ABAP代码读取CDS view association的数据
查看>>
ABAP OPEN SQL里OPEN CURSOR和SELECT的比较
查看>>
如何检查某个用户是否具有某个权限对象上定义的某种权限
查看>>
为什么使用中间件下载时总是收到警告消息Object is in status Wait
查看>>
使用DOM Breakpoints找到修改属性的Javascript代码
查看>>
Fiori里花瓣的动画效果实现原理
查看>>
利用CRM中间件Middleware从ERP下载Customer Material的常见错误
查看>>