Files
jlengrand.github.io/_posts/2013-10-26-find-whether-a-windows-dll-is-compiled-for-32-or-64-bits-on-linux.markdown
Julien Lengrand-Lambert e11060535f Replacing all links with HTTPS
2018-03-17 11:04:40 +01:00

1.7 KiB

layout, status, published, title, author, author_login, author_email, author_url, wordpress_id, wordpress_url, date, categories, tags, comments
layout status published title author author_login author_email author_url wordpress_id wordpress_url date categories tags comments
post publish true Find whether a Windows dll is compiled for 32 or 64 bits on Linux Julien Lengrand-Lambert jlengrand julien@lengrand.fr https://www.lengrand.fr 896 https://www.lengrand.fr/?p=896 2013-10-26 16:33:36.000000000 +02:00
misc
tips
programming
windows
linux
objdump
dll
dependency walker

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:

{% highlight bash %} $ objdump -x my_windows.dll | head -n 15 # returns the first 15 lines of the result

{% endhighlight %}

And here was the result :

{% highlight bash %}

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

{% endhighlight %}

Pretty neat, huh?

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

Well done, Linux. Well done.