0

我正在尝试用 V8 和 Node.js 编译一个模块。我将其配置为dll并下载了源代码并使用vcbuild.bat编译了nodejs。

但是,它会引发错误,例如

错误 2 错误 LNK2028: 未解析的令牌 (0A0005F6) "class v8::Handle __cdecl v8::True(void)" (?True@v8@@$$FYA?AV?$Handle@VBoolean@v8@@@1@XZ ) 在函数 "public: static class v8::Handle __cdecl v8::Boolean::New(bool)" (?New@Boolean@v8@@$$FSA?AV?$Handle@VBoolean@v8@@@2 @_N@Z)

或者

错误 6 错误 LNK2028: 未解析的令牌 (0A0005FE) "public: class v8::Local __thiscall v8::Object::GetPropertyNames(void)" (?GetPropertyNames@Object@v8@@$$FQAE?AV?$Local@VArray@函数“class v8::Handle __cdecl strin(class v8::Arguments const &)”中引用的 v8@@@2@XZ) (?strin@@$$FYA?AV?$Handle@VValue@v8@@@v8 @@ABVArguments@2@@Z) c:\Users\aisha\documents\visual studio 2012\Projects\Project2\Project2\EventLog.obj EventLog

有什么问题?似乎与对象HandleScope有关

4

1 回答 1

0

I have built node with v8 dll on Windows (VS2010). I record what I did to share with you all and also for my reference. The packages are fresh clones from git on this day.

First you build v8 as a dll. I used the method BitCortex suggested in this page. Build googles v8 as shared library on windows?

And then

0) Suppose you are at the root of the source tree.
1) edit vcbuild.bat (for a debug build)
  Line 15 set config=Release -> set config=Debug
  Line 18 set target_arch=ia32  -> set target_arch=x64
      * target-arch should be the arch of your system.
  Line 92  python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
     ->    python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% --shared-v8

2) cp $(v8-dll-build)/include/*h ./src
3) cp $(v8-dll-build)/build/Debug/lib/v8.lib .
4) Build 
   > vcbuild nosign
5) cp $(v8-dll-build)/build/Debug/*.dll Debug

That is all there is to it.

于 2013-11-29T03:37:36.180 回答