To make a package v0.7 deprecation warning free, i recently moved the cfunction s into the @cfunction syntax and got caught on
ERROR: LoadError: could not evaluate cfunction argument type (it might depend on a local variable)
which seems to be correct, the cfunction is
get_stream_callback(T) = @cfunction write_to_stream_callback Int32 (Ref{T}, Ptr{UInt8}, UInt32)
with T from
function CairoPDFSurface(stream::T, w::Real, h::Real) where {T<:IO}
callback = get_stream_callback(T)
ptr = ccall((:cairo_pdf_surface_create_for_stream,_jl_libcairo), Ptr{Nothing},
(Ptr{Nothing}, Any, Float64, Float64), callback, stream, w, h)
CairoSurface(ptr, w, h)
end
I understand, that the cfunction macro needs a concrete(?) type, but does this mean i have to rewrite the function - and drop the parametric type?