Finding DLLs required of a Win exe on Linux (cross

2019-03-16 16:00发布

问题:

I'm using MinGW on Linux to cross-compile to Windows. Getting that working was a breeze. Packing it up with the required DLLs was not quite as simple though. The solution at the moment is to run the executable on Windows and copy over DLLs until it actually runs.

Is there a tool for Linux that lists the DLLs required by my Windows .exe? (Something like a combination of ldd and DependencyWalker.)

回答1:

As of Late 2015 there are no toolchain utilities that support listing dynamic dependencies for windows binaries (such as ldd or otool).

From my tests, a complete dependency list can usually be seen with something like:

strings MY.EXE | grep -i '\.dll$'

Hackish, but it has always worked for me.

For a complete example, try this script I use in my cross environment on linux.