From 573031dd94497751647561fe5acf668710503c18 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sat, 17 Oct 2026 21:08:49 +0200 Subject: [PATCH] Use Base's MPFR library name in `ccall` Julia 1.14 on Windows no longer installs the unversioned `libmpfr.dll`, only `libmpfr-6.dll`, so a `ccall` into `:libmpfr` fails with `could not load library` there (JuliaLang/julia#63849). Use `Base.MPFR.libmpfr`, which names the library that Base itself loads. Julia versions before 1.9 do not define it, so fall back to the bare name there. Co-Authored-By: Claude Opus 5.5 --- src/printf.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/printf.jl b/src/printf.jl index 910bdff..0d3dd88 100644 --- a/src/printf.jl +++ b/src/printf.jl @@ -446,6 +446,9 @@ function _get_strspec(spec) _strspec[spec] = string(spec; modifier="R") end +# `Base.MPFR.libmpfr` was added in Julia 1.9 +const libmpfr = isdefined(Base.MPFR, :libmpfr) ? Base.MPFR.libmpfr : :libmpfr + @static if VERSION < v"1.5" _snprintf(ptr, siz, spec, arg) = ccall((:mpfr_snprintf,:libmpfr), Int32, @@ -453,7 +456,7 @@ _snprintf(ptr, siz, spec, arg) = ptr, siz, spec, arg) else _snprintf(ptr, siz, spec, arg) = - @ccall "libmpfr".mpfr_snprintf(ptr::Ptr{UInt8}, siz::Csize_t, spec::Ptr{UInt8}; + @ccall libmpfr.mpfr_snprintf(ptr::Ptr{UInt8}, siz::Csize_t, spec::Ptr{UInt8}; arg::Ref{BigFloat})::Cint end