I found the reason why I didn't get av_lzo1x_decode compiled into the avutil library when cross-compiling to Windows from Linux the first time (as described in yesterday's blog post). Basically I needed to do sudo apt-get install mingw-w64-tools first, which adds a tool that ensures the necessary library functions get compiled in. Who knew?

Because the flag to use run-time references is enabled by default, you need to recreate the import library from the .dll file using the .def file:

lib /machine:x64 /def:avutil-56.def /out:avutil.lib

Note that if you're using a avutil-56.def file, your executable will be looking for a avutil-56.dll, not avutil.dll as expected. I had to use Dependency Walker to figure this out. And then I discovered that I only built the 32-bit DLL. To build for 64-bit, use:

./configure --enable-shared --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32-

By the way, if you want to check if a DLL file is 32-bit or 64-bit, you can use

dumpbin /headers avutil-56.dll | findstr machine

To use the right DLL with the right architecture, I used the following snippet based on headless-gl's binding.gyp:

'copies': [
    {
      'destination': '$(SolutionDir)$(ConfigurationName)',
      'files': [
        '<(module_root_dir)/lib/<(target_arch)/avutil-56.dll'
      ]
    }
]

This will copy the DLL from either lib/x64 or lib/x86 and put it in the same folder as module.node. Nice!