Skip to content

Add libffi build support for Windows C loader - #844

Open
shaheeramjad wants to merge 15 commits into
metacall:developfrom
shaheeramjad:feature/c-loader-windows-libffi
Open

Add libffi build support for Windows C loader#844
shaheeramjad wants to merge 15 commits into
metacall:developfrom
shaheeramjad:feature/c-loader-windows-libffi

Conversation

@shaheeramjad

Copy link
Copy Markdown

Description

This PR adds libffi build support for the Windows C loader by implementing a Set-C function in tools/metacall-environment.ps1.

The C loader requires libffi as a dependency on Windows. Previously, PR #458 attempted to build libffi using an unofficial third-party fork (newlawrence/Libffi) with hardcoded local paths, which was fragile and not suitable for CI. This PR replaces that approach by building libffi from the official upstream source using the msvcc.sh wrapper script the same method documented in libffi's own README and used internally by vcpkg without introducing vcpkg or any additional tool dependency.

Git Bash (C:\Program Files\Git\bin\bash.exe) is already available on all Windows GitHub Actions runners, so no extra setup is required.

Fixes #458

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests/screenshots (if any) that prove my fix is effective or that my feature works.
  • I have tested the tests implicated (if any) by my own code and they pass.
  • If my change is significant or breaking, I have passed all tests.
  • I have tested my code with OPTION_BUILD_ADDRESS_SANITIZER.
  • I have tested my code with OPTION_BUILD_THREAD_SANITIZER.
  • I have tested with Helgrind.
  • I have run make clang-format.

Note: Full testing requires a Windows environment with MSVC. CI will serve as the primary validation for this change.

@shaheeramjad
shaheeramjad force-pushed the feature/c-loader-windows-libffi branch from 3d0e5b2 to f35b24d Compare July 15, 2026 05:32
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.

1 participant