0

I'm trying to build a node module on Windows 10 with MS VS 2015 and for some reason it's unable to resolve library symbols on node-gyp build. Here is my binding.gyp file:

{
    'variables' : {
        'include_path' : 'path/to/include',
        'lib_path': '/path/to/lib',
    },
    'targets': [
        {
            // name and sources here
            'include_dirs': [
                '<(include_path)',
            ],
            'libraries': [
                '<(lib_path)',
            ],
        },
    ],
}

For some reason, it's unable to resolve any symbols in the library. Here is a snippet of the output:

ProjectBuild.obj : error LNK2001: unresolved external symbol __imp__AiMsgSetLogFileFlags [\path\to\build\project_build.vcxproj]
ProjectBuild.obj : error LNK2001: unresolved external symbol __imp__AiRenderInterrupt [\path\to\build\project_build.vcxproj]

In addition, here is the disassembly of those symbols in the object file dump for that library:

Disassembly of section .text:

0000000000000000 <AiMsgSetLogFileFlags>:
   0:   ff 25 00 00 00 00       jmpq   *0x0(%rip)        # 6 <AiMsgSetLogFileFlags+0x6>
   6:   90                      nop
   7:   90                      nop

ai.dll:     file format pei-x86-64

Disassembly of section .text:

0000000000000000 <AiRenderInterrupt>:
   0:   ff 25 00 00 00 00       jmpq   *0x0(%rip)        # 6 <AiRenderInterrupt+0x6>
   6:   90                      nop
   7:   90                      nop

ai.dll:     file format pei-x86-64

I can confirm with 100% certainty that node-gyp is finding the library file. Does anyone know why it's having trouble linking the symbols in that file? For what it's worth, I'm able to build the module just fine in a linux environment with the exact same binding.gyp file.

Byte Lab
  • 1,576
  • 2
  • 17
  • 42

1 Answers1

0

You need to look into making sure that the symbols you want to export have this. https://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=vs.140%29.aspx

Pavan Kumar Sunkara
  • 3,025
  • 21
  • 30
  • A link to a potential solution is always welcome, but please [add context around the link](http://meta.stackoverflow.com/a/8259/169503) so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. Take into account that being _barely more than a link to an external site_ is a possible reason as to [Why and how are some answers deleted?](http://stackoverflow.com/help/deleted-answers). – Kyll Oct 21 '16 at 09:05