Skip to content

Great tool! One caveat: binaries built with newer versions of Rust end up depending on CoTaskMemFree from combase.dll #32

Description

@z16166

Here’s my setup (using the latest Rust 2024 edition):

https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.3.1/VC-LTL-Binary.7z
https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.2.1-Beta.2/YY-Thunks-Lib.zip
https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.2.1-Beta.2/YY-Thunks-Objs.zip

cargo install thunk-cli

set VC_LTL=f:\win7\VC-LTL5
set YY_THUNKS=f:\win7\YY-Thunks

thunk --os win7 --arch x64 -- --release

The compiled .exe ends up importing CoTaskMemFree from combase.dll, which prevents it from running on Windows 7 x64.

Workaround

Create a combase.c file with the following content:

#pragma comment(linker, "/export:CoTaskMemFree=ole32.CoTaskMemFree")

Then open a Visual Studio x64 Native Tools Prompt and build a stub combase.dll:

cl.exe /LD combase.c /link /NODEFAULTLIB /NOENTRY /out:combase.dll

Place the generated combase.dll in the same directory as exe, and it should run fine on Windows 7 x64.

Note: Some antivirus software may flag this DLL. You can safely ignore it or add an exception.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions