Find whether a Windows dll is compiled for 32 or 64 bits on Linux

Find whether a Windows dll is compiled for 32 or 64 bits on Linux

This morning, I stumbled upon an unexpected problem; and found myself not knowing what to do.

I had to compile the native part of a library on Linux, based on the existing Windows dlls.
Before compiling, I needed to know if the Windows dlls were compiled for 32 or 64 bits.

It is quite easy to do on Windows, with tools such as dependency walker, but on Linux!?

I knew that for native linux (.so) files, objdump would be my weapon of choice.

So I gave it a shot, and tried:

$ objdump -x my_windows.dll | head -n 15 # returns the first 15 lines of the result

And here was the result :

libxuggle-5.dll: file format pei-i386

libxuggle-5.dll

architecture: i386, flags 0x00000133:

HAS_RELOC, EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED

start address 0x6e741058

Characteristics 0x2306

executable

line numbers stripped

32 bit words

debugging information removed

DLL

Pretty neat, huh?

I was really not expecting objdump to be so efficient even on Windows stuff.

Well done, Linux. Well done.