Problem with missing characters - NewInstance is not recommended. Only when working with nw.js

In my project, I use the libvirt library. These are the node bindings to the libvirt api. Since the problem may concern other cases of bindings, I post my question here. After installing with npm install, it gives warnings (one is given 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(); ^ 

When used with regular node applications, this does not cause any problems. However, when nw.js involved, it resets it precisely because of the use of NewInstance. For proof 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 refers to the same method - NewInstance.

This pure code 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(); ... 

Since I am far from being proficient in these V8 issues, maybe someone can advise me what needs to be changed and how to make it work.

+5
source share

All Articles