Closed mkitti closed 2 years ago
I found a way to break LOAD_WITH_ALTERED_SEARCH_PATH
. If a program uses SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)
then using LOAD_WITH_ALTERED_SEARCH_PATH
will fail:
julia> begin
wchar = append!(transcode(UInt16, raw"libdSFMT.dll"), 0x0000)
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000
LOAD_WITH_ALTERED_SEARCH_PATH = 0x8
status = @ccall "kernel32".SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS::UInt32)::Bool # GR.jl v0.70.1
handle = @ccall "kernel32".LoadLibraryExW(wchar::Ptr{UInt16}, C_NULL::Ptr{Nothing}, LOAD_WITH_ALTERED_SEARCH_PATH::UInt32)::Ptr{Nothing} # Julia
if handle == C_NULL
println(Libc.FormatMessage())
end
handle
end
The parameter is incorrect.
Ptr{Nothing} @0x0000000000000000
This is why Plots.jl had a problem with GR 0.70.1.
According to my local tests,
LOAD_WITH_ALTERED_SEARCH_PATH
with an absolute path did always work. This is the same method that is used in Julia. But we can add your patch as a fallback.