Didier Stevens

Tuesday 10 July 2018

Quickpost: Compiling DLLs with MinGW on Kali

Filed under: Quickpost — Didier Stevens @ 0:00

To compile the DLLs from this quickpost with MinGW on Kali, you first have to install MinGW.

Issue this command: apt install mingw-w64

Compile for 64-bit: x86_64-w64-mingw32-gcc -shared -o DemoDll.dll DemoDll.cpp

Compile for 32-bit: i686-w64-mingw32-gcc -shared -o DemoDll-x86.dll DemoDll.cpp

Option -shared is required to produce a DLL in stead of an EXE.

Quickpost info



  1. i tried to compile the code in https://github.com/BUseclab/paybreak using you method but fatal error: Winternl.h: Aucun fichier ou dossier de ce type
    what do you think ? any idea to compile that on Debian for example ?

    Comment by yassine — Wednesday 11 July 2018 @ 22:47

  2. You are missing header file winternl.h.

    Comment by Didier Stevens — Thursday 12 July 2018 @ 6:13

  3. […] Quickpost: Compiling DLLs with MinGW on Kali […]

    Pingback by Overview of Content Published in July | Didier Stevens — Thursday 2 August 2018 @ 0:01

  4. […] is not only available on Kali, of course, but also on Windows. Compiling a DLL is very […]

    Pingback by Quickpost: Compiling DLLs with MinGW on Windows | Didier Stevens — Tuesday 28 August 2018 @ 0:00

  5. […] To compile a Windows executable with version information and an icon on Kali, we use MinGW again. […]

    Pingback by Quickpost: Compiling EXEs and Resources with MinGW on Kali | Didier Stevens — Monday 17 September 2018 @ 0:01

  6. […] Compiling a service DLL (a Windows DLL implementing a service to be executed inside a shared svchost.exe process) with MinGW on Kali, is almost the same as compiling a DLL. […]

    Pingback by Quickpost: Compiling Service DLLs with MinGW on Kali | Didier Stevens — Monday 28 October 2019 @ 7:36

RSS feed for comments on this post. TrackBack URI

Leave a Reply (comments are moderated)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.