Wrong conversion of String to C String?
I noticed this line of code in GraphViz.jl package, but later on a String object being used here (note the format="julia:cairo"). It doesn't seem right? The function expects C string, not Julia string? Could it be the reason for https://github.com/JuliaLang/julia/issues/56150?
related PR https://github.com/JuliaLang/julia/pull/51275
I couldn't patch it and test it with the change due to #44
Also see this comment https://github.com/JuliaLang/julia/issues/56150#issuecomment-2559741955
I found the line
ccall((:gvRenderContext,libgvc),Cint,(Ptr{Cvoid},Ptr{Cvoid},Ptr{UInt8},Ptr{Cvoid}),context.handle,g.handle,format,C_NULL)
returns -1 and prints the error Error: renderer for julia:cairo is unavailable.
By changing the lines
const julia_cairo_name = Vector{UInt8}("julia:cairo")
const julia_cairo_libname = Vector{UInt8}("julia:cairo")
to
const julia_cairo_name = Base.unsafe_convert(Cstring,"julia:cairo")
const julia_cairo_libname = Base.unsafe_convert(Cstring,"julia:cairo")
it returns 0 with no error.