Justin
Justin

Reputation: 3443

Using my native node module with Electron

So i have built a simple node demo module that works fine with node.exe but when i try to require it with atom electron as a module it does not work even though it was linked with the exact same version of node that my version of electron uses and it the same machine type (x86) I have tried to use the electron source (node.dll.lib) instead but it I get v8 link errors What is the excepted way to do this?

Severity Code Description Project File Line Error LNK2019 unresolved external symbol "public: __thiscall v8::HandleScope::HandleScope(class v8::Isolate *)" (??0HandleScope@v8@@QAE@PAVIsolate@1@@Z) referenced in function "void __cdecl node::NODE_SET_PROTOTYPE_METHOD(class v8::Local,char const ,void (__cdecl)(class v8::FunctionCallbackInfo const &))" (?NODE_SET_PROTOTYPE_METHOD@node@@YAXV?$Local@VFunctionTemplate@v8@@@v8@@PBDP6AXABV?$FunctionCallbackInfo@VValue@v8@@@3@@Z@Z) nodeaddon c:\src\justin\nodeaddon\nodeaddon\myobject.obj 1

Upvotes: 2

Views: 2127

Answers (2)

Justin
Justin

Reputation: 3443

I ended up setting changing my linker and compiler paths to point to the electron as apposed to the node source source and at all works now.

Upvotes: 0

eljefedelrodeodeljefe
eljefedelrodeodeljefe

Reputation: 6811

According to the docs you'd need to rebuild electron with you native module. The easiest way is to use electron-rebuild, which the team provides.

Upvotes: 1

Related Questions