Skip to content

fix: add Windows/MSVC support for C Loader (libffi, libclang, TCC) - #780

Closed
masha2100 wants to merge 3 commits into
metacall:developfrom
masha2100:feature/windows-c-loader
Closed

masha2100 wants to merge 3 commits into
metacall:developfrom
masha2100:feature/windows-c-loader

Conversation

@masha2100

Copy link
Copy Markdown

Problem

C Loader had no Windows support in CMake find modules - all search paths were Linux-only.

Changes

  • FindLibFFI.cmake: add Windows search paths (LIBFFI_ROOT, vcpkg, choco, scoop)
  • FindLibTCC.cmake: add Windows search paths (TCC_ROOT, C:/tcc)
  • FindLibClang.cmake: add Windows search paths (LLVM_ROOT, Program Files/LLVM)
  • InstallLibTCC.cmake: fix MSVC configure and build steps
  • tcc_build_msvc.bat: helper script for TCC build on MSVC

Result

c_loader.dll successfully builds on Windows x64 with MSVC 19.42

Tested with

  • libffi 3.5.2 (vcpkg)
  • LLVM/libclang 22.1.0 (Chocolatey)
  • TCC built from source (metacall/tinycc)

Refs: #458

- FindLibFFI.cmake: add Windows search paths (vcpkg, choco, LIBFFI_ROOT)
- FindLibTCC.cmake: add Windows search paths (TCC_ROOT, C:/tcc)
- FindLibClang.cmake: add Windows search paths (LLVM_ROOT, Program Files/LLVM)
- InstallLibTCC.cmake: fix MSVC configure and build steps
- tcc_build_msvc.bat: helper script for TCC build on MSVC

Refs: metacall#458
@viferga

viferga commented Apr 22, 2026

Copy link
Copy Markdown
Member

Have you tested it?

@viferga

viferga commented Apr 22, 2026

Copy link
Copy Markdown
Member

I cannot merge it.. it breaks all the indentation and it just doesn't work. Test it on your fork until it works before PRing it here.

@viferga viferga closed this Apr 22, 2026
@masha2100

Copy link
Copy Markdown
Author

I cannot merge it.. it breaks all the indentation and it just doesn't work. Test it on your fork until it works before PRing it here.

Hi, I understand the issue with indentation. I will fix it and reopen the PR. Sorry for the inconvenience.

@viferga

viferga commented Apr 23, 2026

Copy link
Copy Markdown
Member

PR when you have tested it on your fork and it works.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants