In my project I use the libvirt
library. These are node bindings to libvirt
api. As the issue can relate to other cases of bindings I post my question here.
Upon installation with npm install it throws warnings (one below as an example)
../src/domain.cc: In static member function ‘static v8::Local<v8::Object> NLV::Domain::NewInstance(virDomainPtr)’:
../src/domain.cc:197:44: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance() const’ is deprecated (declared at /home/mark/.node-gyp/6.3.1/include/node/v8.h:3243): Use maybe version [-Wdeprecated-declarations]
Local<Object> object = ctor->NewInstance();
^
In use with plain node apps, it later causes no problems. However, when nw.js
is involved, it crashes it exactly due to this NewInstance use. For evidence see:
....nwjs/nw: symbol lookup error: ..../project/node_modules/libvirt/
build/Release/libvirt.node:
undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEi
Aborted (core dumped)
This symbol in question refers the same method - NewInstance.
The code in question, in its pure form looks like this:
Domain::Domain(virDomainPtr handle) : NLVObject(handle) {}
Local<Object> Domain::NewInstance(virDomainPtr handle)
{
Nan::EscapableHandleScope scope;
Local<Function> ctor = Nan::New<Function>(constructor);
Local<Object> object = ctor->NewInstance();
...
As I'm far from being proficient in these V8 matters maybe someone can advise me what to alter and how to make it work.