Actually eliminate the shell32.dll
/ole32.dll
dependency when LLVM is enabled
#18108
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
Follow up to #18091
The
-delayload
approach can definitely work. I've got a proof-of-concept LLVM-enabled compiler without shell32.dll/ole32.dll dependencies built by doing the following:shell32.lib
/ole32.lib
viadlltool
as outlined here: https://github.com/AustinWise/delay-load-mingwshell32.def
:dlltool --input-def shell32.def --output-delaylib shell32.lib --dllname shell32.dll
ole32.def
:dlltool --input-def ole32.def --output-delaylib ole32.lib --dllname ole32.dll
zig build -p stage4-debug -Denable-llvm -Dno-lib --verbose-link
lld-link
invocation and copied it into a.bat
file.lib
paths; if any of the.lib
filepaths have spaces you'll have to quote themshell32.lib
andole32.lib
with the path to the.lib
files generated bydlltool
-delayload:ole32.dll -delayload:shell32.dll
to the command-OUT:
path with a path outside of the cache directory, e.g.-OUT:C:\Users\Ryan\Programming\Zig\zig\build\zig-delayload.exe
lld-link
in my PATHThe result:
No
shell32.dll
/ole32.dll
However, I have a feeling this might explode if the
shell32
/ole32
functions are called from within LLVM, as I thinkdelayimp
needs to be linked and it's not being linked currently. I was able to get the test in https://github.com/AustinWise/delay-load-mingw confirmed to work withclang
andlld-link
via:but I think it's using
delayimp.lib
from MSVC.Things that need to be figured out:
home_directory
dlltool
to generate the.lib
files-delayload
linker flags properly and use them when building the Zig compilergnu
andmsvc
ABI targets, or make it work for both ABI targetsThe text was updated successfully, but these errors were encountered: