Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "long format" DLL import libraries #15119

Conversation

HertzDevil
Copy link
Contributor

Crystal::System::LibraryArchive.imported_dlls is used by the interpreter to obtain all dependent DLLs of a given import library. Currently, the method only supports libraries using the short format, emitted by MSVC's linker. This PR implements the long format used by MinGW-w64 when passing the -Wl,--out-implib flag to cc.

Specs will be added when Crystal::Loader supports MinGW-w64. In the mean time, if you have MSYS2, you could try this on the UCRT64 import libraries:

require "crystal/system/win32/library_archive"

Crystal::System::LibraryArchive.imported_dlls("C:/msys64/ucrt64/lib/libpcre2-8.dll.a") # => Set{"libpcre2-8-0.dll"}
Crystal::System::LibraryArchive.imported_dlls("C:/msys64/ucrt64/lib/libucrt.a")        # => Set{"api-ms-win-crt-utility-l1-1-0.dll", "api-ms-win-crt-time-l1-1-0.dll", "api-ms-win-crt-string-l1-1-0.dll", "api-ms-win-crt-stdio-l1-1-0.dll", "api-ms-win-crt-runtime-l1-1-0.dll", "api-ms-win-crt-process-l1-1-0.dll", "api-ms-win-crt-private-l1-1-0.dll", "api-ms-win-crt-multibyte-l1-1-0.dll", "api-ms-win-crt-math-l1-1-0.dll", "api-ms-win-crt-locale-l1-1-0.dll", "api-ms-win-crt-heap-l1-1-0.dll", "api-ms-win-crt-filesystem-l1-1-0.dll", "api-ms-win-crt-environment-l1-1-0.dll", "api-ms-win-crt-convert-l1-1-0.dll", "api-ms-win-crt-conio-l1-1-0.dll"}

@HertzDevil HertzDevil added kind:feature topic:compiler:interpreter platform:windows-gnu Windows support based on the MinGW-w64 toolchain + MSYS2 labels Oct 23, 2024
@straight-shoota straight-shoota added this to the 1.15.0 milestone Oct 23, 2024
@straight-shoota straight-shoota merged commit 0236a68 into crystal-lang:master Oct 25, 2024
68 checks passed
@HertzDevil HertzDevil deleted the feature/win32-long-import-libraries branch October 25, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature platform:windows-gnu Windows support based on the MinGW-w64 toolchain + MSYS2 topic:compiler:interpreter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants