Search code examples
dll64-bitdynamic-linkingmingw-w64comctl32

How to link a 64 executable that require an rsrc section and comctl32.dll?


Trying to build UltraDefrag.

Sounds pretty simple, but as soon as you add a rc.o to the link objects of your binary, it will use the 32 bit version of comctl32.dll triggering a 0xc0000007 error on program startup.

This is a known mingw64 bug, but as the bug had no replies since 2011, I need a workaround for this (the program need to not use cygwin.dll, so I can’t use cygwin).

Any ideas ?


Solution

  • This can happen if the application manifest explicitly specifies the 32-bit version of common controls

    i.e. the manifest contains

    <dependentAssembly>
    <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="x86"
        publicKeyToken="6595b64144ccf1df"
        language="*"
    />
    

    You need to change the processorArchitecture to:

    processorArchitecture="*"
    

    If that is the cause of your problem, this is not a MinGW-w64 bug.